Browse Source

Improve solution file handling and cleanup unused usings

Removed unused using directives in AbpCliCoreModule and NewCommand for better code clarity. Refactored AddPackageCommand to inline solution and project file retrieval. Enhanced TelemetrySolutionInfoEnricher to support '.slnx' files by mapping them to '.abpsln' if present.
pull/24395/head
SALİH ÖZKARA 10 months ago
parent
commit
144d3d3f88
  1. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs
  2. 7
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs
  3. 1
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs
  4. 9
      framework/src/Volo.Abp.Core/Volo/Abp/Internal/Telemetry/Activity/Providers/TelemetrySolutionInfoEnricher.cs

2
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs

@ -1,4 +1,3 @@
using System.Collections.Generic;
using System.Text; using System.Text;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Cli.Commands; using Volo.Abp.Cli.Commands;
@ -11,7 +10,6 @@ using Volo.Abp.Cli.ServiceProxying.JavaScript;
using Volo.Abp.Domain; using Volo.Abp.Domain;
using Volo.Abp.Http; using Volo.Abp.Http;
using Volo.Abp.IdentityModel; using Volo.Abp.IdentityModel;
using Volo.Abp.Internal.Telemetry.Activity.Providers;
using Volo.Abp.Json; using Volo.Abp.Json;
using Volo.Abp.Localization; using Volo.Abp.Localization;
using Volo.Abp.Minify; using Volo.Abp.Minify;

7
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs

@ -63,12 +63,9 @@ public class AddPackageCommand : IConsoleCommand, ITransientDependency
{ {
var addSourceCodeToSolutionFile = withSourceCode && commandLineArgs.Options.ContainsKey("add-to-solution-file"); var addSourceCodeToSolutionFile = withSourceCode && commandLineArgs.Options.ContainsKey("add-to-solution-file");
var slnFile = GetSolutionFile(commandLineArgs);
var projectFile = GetProjectFile(commandLineArgs);
await ProjectNugetPackageAdder.AddAsync( await ProjectNugetPackageAdder.AddAsync(
slnFile, GetSolutionFile(commandLineArgs),
projectFile, GetProjectFile(commandLineArgs),
commandLineArgs.Target, commandLineArgs.Target,
version, version,
true, true,

1
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs

@ -12,7 +12,6 @@ using Volo.Abp.Cli.LIbs;
using Volo.Abp.Cli.ProjectBuilding; using Volo.Abp.Cli.ProjectBuilding;
using Volo.Abp.Cli.ProjectBuilding.Events; using Volo.Abp.Cli.ProjectBuilding.Events;
using Volo.Abp.Cli.ProjectBuilding.Templates.Module; using Volo.Abp.Cli.ProjectBuilding.Templates.Module;
using Volo.Abp.Cli.ProjectBuilding.Templates.MvcModule;
using Volo.Abp.Cli.ProjectModification; using Volo.Abp.Cli.ProjectModification;
using Volo.Abp.Cli.Utils; using Volo.Abp.Cli.Utils;
using Volo.Abp.Cli.Version; using Volo.Abp.Cli.Version;

9
framework/src/Volo.Abp.Core/Volo/Abp/Internal/Telemetry/Activity/Providers/TelemetrySolutionInfoEnricher.cs

@ -188,6 +188,15 @@ internal sealed class TelemetrySolutionInfoEnricher : TelemetryActivityEventEnri
} }
} }
if (solutionPath.EndsWith(".slnx"))
{
solutionPath = solutionPath[..^5] + ".abpsln";
if (File.Exists(solutionPath))
{
return solutionPath;
}
}
var dir = Path.GetDirectoryName(solutionPath); var dir = Path.GetDirectoryName(solutionPath);
if (dir.IsNullOrEmpty()) if (dir.IsNullOrEmpty())
{ {

Loading…
Cancel
Save