diff --git a/docs/en/CLI.md b/docs/en/CLI.md index 8551d64505..f7b5ab88aa 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -90,6 +90,7 @@ abp new Acme.BookStore * **`console`**: [Console template](Startup-Templates/Console.md). * `--output-folder` or `-o`: Specifies the output folder. Default value is the current directory. * `--version` or `-v`: Specifies the ABP & template version. It can be a [release tag](https://github.com/abpframework/abp/releases) or a [branch name](https://github.com/abpframework/abp/branches). Uses the latest release if not specified. Most of the times, you will want to use the latest version. +* `--preview`: Use latest pre-release version (Only if `--version ` is not specified and there is at least one pre-release after latest stable version). * `--template-source` or `-ts`: Specifies a custom template source to use to build the project. Local and network sources can be used(Like `D:\local-template` or `https://.../my-template-file.zip`). * `--create-solution-folder` or `-csf`: Specifies if the project will be in a new folder in the output folder or directly the output folder. * `--connection-string` or `-cs`: Overwrites the default connection strings in all `appsettings.json` files. The default connection string is `Server=localhost;Database=MyProjectName;Trusted_Connection=True;MultipleActiveResultSets=true` for EF Core and it is configured to use the SQL Server. If you want to use the EF Core, but need to change the DBMS, you can change it as [described here](Entity-Framework-Core-Other-DBMS.md) (after creating the solution). @@ -196,12 +197,12 @@ abp generate-proxy --apiUrl https://localhost:44305 --ui angular --module all ### switch-to-preview -You can use this command to switch your project to latest preview version of the ABP framework packages. +You can use this command to switch your project to latest **nightly** preview version of the ABP framework packages. Usage: ````bash -abp switch-to-preview [options] +abp switch-to-nightly [options] ```` #### Options @@ -210,7 +211,7 @@ abp switch-to-preview [options] ### switch-to-stable -If you're using the ABP Framework preview packages, you can switch back to stable version using this command. +If you're using the ABP Framework preview packages, you can switch back to latest stable version using this command. Usage: diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs index dbffa820c8..0244d46c47 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs @@ -1,5 +1,4 @@ -using System; -using System.Text; +using System.Text; using Volo.Abp.Cli.Commands; using Volo.Abp.Domain; using Volo.Abp.IdentityModel; @@ -31,8 +30,9 @@ namespace Volo.Abp.Cli options.Commands["logout"] = typeof(LogoutCommand); options.Commands["generate-proxy"] = typeof(GenerateProxyCommand); options.Commands["suite"] = typeof(SuiteCommand); - options.Commands["switch-to-preview"] = typeof(SwitchNightlyPreviewCommand); - options.Commands["switch-to-stable"] = typeof(SwitchStableCommand); + options.Commands["switch-to-preview"] = typeof(SwitchToPreviewCommand); + options.Commands["switch-to-stable"] = typeof(SwitchToStableCommand); + options.Commands["switch-to-nightly"] = typeof(SwitchToNightlyCommand); options.Commands["translate"] = typeof(TranslateCommand); }); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs index 436e169aad..ef6eb79042 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs @@ -158,7 +158,7 @@ namespace Volo.Abp.Cli return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli"); case UpdateChannel.Prerelease: - return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli", includePreviews: true); + return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli", includeReleaseCandidates: true); case UpdateChannel.Nightly: return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli", includeNightly: true); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs index b37f67fd1a..5e690d8bb0 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs @@ -75,6 +75,7 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine(" -s|--solution Specify the solution file explicitly."); sb.AppendLine(" --skip-db-migrations Specify if a new migration will be added or not."); sb.AppendLine(" -sp|--startup-project Relative path to the project folder of the startup project. Default value is the current folder."); + sb.AppendLine(" -v|--version Specify the version of the module. Default is your project's ABP version."); sb.AppendLine(""); sb.AppendLine("Examples:"); sb.AppendLine(""); @@ -152,7 +153,7 @@ namespace Volo.Abp.Cli.Commands public const string Skip = "skip-db-migrations"; } - public static class StartupProject + public static class StartupProject { public const string Short = "sp"; public const string Long = "startup-project"; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs index 03e228f255..7ea20eccf4 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs @@ -34,9 +34,12 @@ namespace Volo.Abp.Cli.Commands ); } + var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long); + await ProjectNugetPackageAdder.AddAsync( GetProjectFile(commandLineArgs), - commandLineArgs.Target + commandLineArgs.Target, + version ); } @@ -55,6 +58,7 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine("Options:"); sb.AppendLine(""); sb.AppendLine(" -p|--project Specify the project file explicitly."); + sb.AppendLine(" -v|--version Specify the version of the package. Default is your project's ABP version or latest ABP version."); sb.AppendLine(""); sb.AppendLine("Examples:"); sb.AppendLine(""); @@ -119,6 +123,12 @@ namespace Volo.Abp.Cli.Commands public const string Short = "p"; public const string Long = "project"; } + + public static class Version + { + public const string Short = "v"; + public const string Long = "version"; + } } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs index 0a6155fa67..7cda59b999 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs @@ -61,7 +61,7 @@ namespace Volo.Abp.Cli.Commands } commandLineArgs.Options.Add(CliConsts.Command, commandLineArgs.Command); - + await _sourceCodeDownloadService.DownloadAsync( commandLineArgs.Target, outputFolder, version, gitHubAbpLocalRepositoryPath, gitHubVoloLocalRepositoryPath, commandLineArgs.Options); } @@ -99,6 +99,7 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine(""); sb.AppendLine("-o|--output-folder (default: current folder)"); sb.AppendLine("-v|--version (default: latest version)"); + sb.AppendLine("--preview (Use latest pre-release version if there is at least one pre-release after latest stable version)"); sb.AppendLine(""); sb.AppendLine("Examples:"); sb.AppendLine(""); @@ -138,6 +139,11 @@ namespace Volo.Abp.Cli.Commands public const string Short = "v"; public const string Long = "version"; } + + public static class Preview + { + public const string Long = "preview"; + } } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index 8a6d944226..4a713ceb9e 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -62,6 +62,12 @@ namespace Volo.Abp.Cli.Commands Logger.LogInformation("Tiered: yes"); } + var preview = commandLineArgs.Options.ContainsKey(Options.Preview.Long); + if (preview) + { + Logger.LogInformation("Preview: yes if any exist for next version."); + } + var databaseProvider = GetDatabaseProvider(commandLineArgs); if (databaseProvider != DatabaseProvider.NotSpecified) { @@ -218,6 +224,7 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine("-d|--database-provider (if supported by the template)"); sb.AppendLine("-o|--output-folder (default: current folder)"); sb.AppendLine("-v|--version (default: latest version)"); + sb.AppendLine("--preview (Use latest pre-release version if there is at least one pre-release after latest stable version)"); sb.AppendLine("-ts|--template-source (your local or network abp template source)"); sb.AppendLine("-csf|--create-solution-folder (default: true)"); sb.AppendLine("-cs|--connection-string (your database connection string)"); @@ -369,6 +376,11 @@ namespace Volo.Abp.Cli.Commands { public const string Long = "tiered"; } + + public static class Preview + { + public const string Long = "preview"; + } } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchNightlyPreviewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchToNightlyCommand.cs similarity index 64% rename from framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchNightlyPreviewCommand.cs rename to framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchToNightlyCommand.cs index 883ac4db2f..473489990f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchNightlyPreviewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchToNightlyCommand.cs @@ -6,18 +6,18 @@ using Volo.Abp.DependencyInjection; namespace Volo.Abp.Cli.Commands { - public class SwitchNightlyPreviewCommand : IConsoleCommand, ITransientDependency + public class SwitchToNightlyCommand : IConsoleCommand, ITransientDependency { - private readonly PackageSourceSwitcher _packageSourceSwitcher; + private readonly PackagePreviewSwitcher _packagePreviewSwitcher; - public SwitchNightlyPreviewCommand(PackageSourceSwitcher packageSourceSwitcher) + public SwitchToNightlyCommand(PackagePreviewSwitcher packagePreviewSwitcher) { - _packageSourceSwitcher = packageSourceSwitcher; + _packagePreviewSwitcher = packagePreviewSwitcher; } public async Task ExecuteAsync(CommandLineArgs commandLineArgs) { - await _packageSourceSwitcher.SwitchToPreview(commandLineArgs); + await _packagePreviewSwitcher.SwitchToNightlyPreview(commandLineArgs); } public string GetUsageInfo() @@ -26,8 +26,8 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine(""); sb.AppendLine("Usage:"); - sb.AppendLine(" abp switch-to-preview [options]"); - sb.AppendLine(""); + sb.AppendLine(" abp switch-to-nightly [options]"); + sb.AppendLine(""); sb.AppendLine("Options:"); sb.AppendLine("-sd|--solution-directory"); sb.AppendLine(""); @@ -41,4 +41,4 @@ namespace Volo.Abp.Cli.Commands return "Switches packages to nightly preview ABP version."; } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchToPreviewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchToPreviewCommand.cs new file mode 100644 index 0000000000..e6c401a8b5 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchToPreviewCommand.cs @@ -0,0 +1,44 @@ +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Cli.Args; +using Volo.Abp.Cli.ProjectModification; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Cli.Commands +{ + public class SwitchToPreviewCommand : IConsoleCommand, ITransientDependency + { + private readonly PackagePreviewSwitcher _packagePreviewSwitcher; + + public SwitchToPreviewCommand(PackagePreviewSwitcher packagePreviewSwitcher) + { + _packagePreviewSwitcher = packagePreviewSwitcher; + } + + public async Task ExecuteAsync(CommandLineArgs commandLineArgs) + { + await _packagePreviewSwitcher.SwitchToPreview(commandLineArgs); + } + + public string GetUsageInfo() + { + var sb = new StringBuilder(); + + sb.AppendLine(""); + sb.AppendLine("Usage:"); + sb.AppendLine(" abp switch-to-preview [options]"); + sb.AppendLine(""); + sb.AppendLine("Options:"); + sb.AppendLine("-sd|--solution-directory"); + sb.AppendLine(""); + sb.AppendLine("See the documentation for more info: https://docs.abp.io/en/abp/latest/CLI"); + + return sb.ToString(); + } + + public string GetShortDescription() + { + return "Switches packages to preview ABP version."; + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchStableCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchToStableCommand.cs similarity index 72% rename from framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchStableCommand.cs rename to framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchToStableCommand.cs index 54db7bc082..61545a3da5 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchStableCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchToStableCommand.cs @@ -6,18 +6,18 @@ using Volo.Abp.DependencyInjection; namespace Volo.Abp.Cli.Commands { - public class SwitchStableCommand : IConsoleCommand, ITransientDependency + public class SwitchToStableCommand : IConsoleCommand, ITransientDependency { - private readonly PackageSourceSwitcher _packageSourceSwitcher; + private readonly PackagePreviewSwitcher _packagePreviewSwitcher; - public SwitchStableCommand(PackageSourceSwitcher packageSourceSwitcher) + public SwitchToStableCommand(PackagePreviewSwitcher packagePreviewSwitcher) { - _packageSourceSwitcher = packageSourceSwitcher; + _packagePreviewSwitcher = packagePreviewSwitcher; } public async Task ExecuteAsync(CommandLineArgs commandLineArgs) { - await _packageSourceSwitcher.SwitchToStable(commandLineArgs); + await _packagePreviewSwitcher.SwitchToStable(commandLineArgs); } public string GetUsageInfo() @@ -41,4 +41,4 @@ namespace Volo.Abp.Cli.Commands return "Switches packages to stable ABP version from preview version."; } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs index 0fd35582bf..c962ceaf92 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs @@ -39,7 +39,7 @@ namespace Volo.Abp.Cli.NuGet Logger = NullLogger.Instance; } - public async Task GetLatestVersionOrNullAsync(string packageId, bool includePreviews = false, bool includeNightly = false) + public async Task GetLatestVersionOrNullAsync(string packageId, bool includeNightly = false, bool includeReleaseCandidates = false) { if (AuthService.IsLoggedIn()) { @@ -78,11 +78,12 @@ namespace Volo.Abp.Cli.NuGet var versions = JsonSerializer .Deserialize(responseContent) .Versions - .Select(SemanticVersion.Parse); + .Select(SemanticVersion.Parse) + .OrderByDescending(v=> v, new VersionComparer()).ToList(); - if (!includePreviews && !includeNightly) + if (!includeNightly && !includeReleaseCandidates) { - versions = versions.Where(x => !x.IsPrerelease); + versions = versions.Where(x => !x.IsPrerelease).ToList(); } var semanticVersions = versions.ToList(); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs index f221186636..106d7b5bcc 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs @@ -52,10 +52,11 @@ namespace Volo.Abp.Cli.ProjectBuilding string name, string type, string version = null, - string templateSource = null) + string templateSource = null, + bool includePreReleases = false) { DirectoryHelper.CreateIfNotExists(CliPaths.TemplateCache); - var latestVersion = version ?? await GetLatestSourceCodeVersionAsync(name, type); + var latestVersion = version ?? await GetLatestSourceCodeVersionAsync(name, type, null, includePreReleases); if (version == null) { @@ -110,7 +111,8 @@ namespace Volo.Abp.Cli.ProjectBuilding Name = name, Type = type, TemplateSource = templateSource, - Version = version + Version = version, + IncludePreReleases = includePreReleases } ); @@ -122,7 +124,7 @@ namespace Volo.Abp.Cli.ProjectBuilding return new TemplateFile(fileContent, version, latestVersion, nugetVersion); } - private async Task GetLatestSourceCodeVersionAsync(string name, string type, string url = null) + private async Task GetLatestSourceCodeVersionAsync(string name, string type, string url = null, bool includePreReleases = false) { if (url == null) { @@ -137,7 +139,7 @@ namespace Volo.Abp.Cli.ProjectBuilding url, new StringContent( JsonSerializer.Serialize( - new GetLatestSourceCodeVersionDto { Name = name } + new GetLatestSourceCodeVersionDto { Name = name, IncludePreReleases = includePreReleases } ), Encoding.UTF8, MimeTypes.Application.Json @@ -171,7 +173,7 @@ namespace Volo.Abp.Cli.ProjectBuilding url, new StringContent( JsonSerializer.Serialize( - new GetTemplateNugetVersionDto { Name = name, Version = version } + new GetTemplateNugetVersionDto { Name = name, Version = version} ), Encoding.UTF8, MimeTypes.Application.Json @@ -260,11 +262,15 @@ namespace Volo.Abp.Cli.ProjectBuilding public string Type { get; set; } public string TemplateSource { get; set; } + + public bool IncludePreReleases { get; set; } } public class GetLatestSourceCodeVersionDto { public string Name { get; set; } + + public bool IncludePreReleases { get; set; } } public class GetTemplateNugetVersionDto @@ -272,6 +278,8 @@ namespace Volo.Abp.Cli.ProjectBuilding public string Name { get; set; } public string Version { get; set; } + + public bool IncludePreReleases { get; set; } } public class GetVersionResultDto diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ISourceCodeStore.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ISourceCodeStore.cs index de082d4bcf..af03a6095b 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ISourceCodeStore.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ISourceCodeStore.cs @@ -9,7 +9,8 @@ namespace Volo.Abp.Cli.ProjectBuilding string name, string type, [CanBeNull] string version = null, - [CanBeNull] string templateSource = null + [CanBeNull] string templateSource = null, + bool includePreReleases = false ); } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs index 6a7132769a..17b9585f16 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs @@ -48,7 +48,9 @@ namespace Volo.Abp.Cli.ProjectBuilding var templateFile = await SourceCodeStore.GetAsync( args.TemplateName, SourceCodeTypes.Module, - args.Version + args.Version, + null, + args.ExtraProperties.ContainsKey(GetSourceCommand.Options.Preview.Long) ); var apiKeyResult = await ApiKeyService.GetApiKeyOrNullAsync(); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs index e8ddc804c2..02b26eba39 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs @@ -57,7 +57,8 @@ namespace Volo.Abp.Cli.ProjectBuilding args.TemplateName, SourceCodeTypes.Template, args.Version, - args.TemplateSource + args.TemplateSource, + args.ExtraProperties.ContainsKey(NewCommand.Options.Preview.Long) ); DeveloperApiKeyResult apiKeyResult = null; @@ -119,6 +120,7 @@ namespace Volo.Abp.Cli.ProjectBuilding var options = args.ExtraProperties .Where(x => !x.Key.Equals(CliConsts.Command, StringComparison.InvariantCultureIgnoreCase)) .Where(x => !x.Key.Equals(NewCommand.Options.Tiered.Long, StringComparison.InvariantCultureIgnoreCase)) + .Where(x => !x.Key.Equals(NewCommand.Options.Preview.Long, StringComparison.InvariantCultureIgnoreCase)) .Where(x => !x.Key.Equals(NewCommand.Options.DatabaseProvider.Long, StringComparison.InvariantCultureIgnoreCase) && !x.Key.Equals(NewCommand.Options.DatabaseProvider.Short, StringComparison.InvariantCultureIgnoreCase)) .Where(x => !x.Key.Equals(NewCommand.Options.OutputFolder.Long, StringComparison.InvariantCultureIgnoreCase) && diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs index 4730fed899..359ad09684 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs @@ -10,6 +10,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using NuGet.Versioning; using Volo.Abp.Cli.Http; using Volo.Abp.Cli.Utils; using Volo.Abp.DependencyInjection; @@ -42,7 +43,7 @@ namespace Volo.Abp.Cli.ProjectModification Logger = NullLogger.Instance; } - public async Task Update(string rootDirectory, bool includePreviews = false, bool switchToStable = false) + public async Task Update(string rootDirectory, bool includePreviews = false, bool includeReleaseCandidates = false, bool switchToStable = false) { var fileList = _packageJsonFileFinder.Find(rootDirectory); @@ -57,7 +58,7 @@ namespace Volo.Abp.Cli.ProjectModification async Task UpdateAsync(string file) { - var updated = await UpdatePackagesInFile(file, includePreviews, switchToStable); + var updated = await UpdatePackagesInFile(file, includePreviews,includeReleaseCandidates, switchToStable); packagesUpdated.TryAdd(file, updated); } @@ -176,7 +177,10 @@ namespace Volo.Abp.Cli.ProjectModification return File.Exists(Path.Combine(fileDirectory, "angular.json")); } - protected virtual async Task UpdatePackagesInFile(string filePath, bool includePreviews = false, + protected virtual async Task UpdatePackagesInFile( + string filePath, + bool includePreviews = false, + bool includeReleaseCandidates = false, bool switchToStable = false) { var packagesUpdated = false; @@ -191,7 +195,7 @@ namespace Volo.Abp.Cli.ProjectModification foreach (var abpPackage in abpPackages) { - var updated = await TryUpdatingPackage(filePath, abpPackage, includePreviews, switchToStable); + var updated = await TryUpdatingPackage(filePath, abpPackage, includePreviews, includeReleaseCandidates, switchToStable); if (updated) { @@ -210,18 +214,26 @@ namespace Volo.Abp.Cli.ProjectModification string filePath, JProperty package, bool includePreviews = false, + bool includeReleaseCandidates = false, bool switchToStable = false) { var currentVersion = (string) package.Value; var version = ""; - if (includePreviews || (!switchToStable && currentVersion.Contains("-preview"))) + if ((includePreviews || (!switchToStable && currentVersion.Contains("-preview"))) && !includeReleaseCandidates) { version = "preview"; } else { - version = await GetLatestVersion(package); + if (!switchToStable && SemanticVersion.Parse(currentVersion).IsPrerelease) + { + version = await GetLatestVersion(package, true); + } + else + { + version = await GetLatestVersion(package, includeReleaseCandidates); + } } if (version == currentVersion) @@ -237,14 +249,22 @@ namespace Volo.Abp.Cli.ProjectModification } protected virtual async Task GetLatestVersion( - JProperty package) + JProperty package, + bool includeReleaseCandidates = false) { if (_fileVersionStorage.ContainsKey(package.Name)) { return _fileVersionStorage[package.Name]; } - var newVersion = CmdHelper.RunCmdAndGetOutput($"npm show {package.Name} version"); + var versionListAsJson = CmdHelper.RunCmdAndGetOutput($"npm show {package.Name} versions"); + var versionList = JsonConvert.DeserializeObject(versionListAsJson) + .OrderByDescending(SemanticVersion.Parse, new VersionComparer()).ToList(); + + var newVersion = includeReleaseCandidates + ? versionList.First() + : versionList.FirstOrDefault(v => !SemanticVersion.Parse(v).IsPrerelease); + var newVersionWithPrefix = $"~{newVersion}"; _fileVersionStorage[package.Name] = newVersionWithPrefix; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageSourceSwitcher.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackagePreviewSwitcher.cs similarity index 73% rename from framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageSourceSwitcher.cs rename to framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackagePreviewSwitcher.cs index f6c89be039..60c7fd21b9 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageSourceSwitcher.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackagePreviewSwitcher.cs @@ -9,31 +9,46 @@ using Volo.Abp.DependencyInjection; namespace Volo.Abp.Cli.ProjectModification { - public class PackageSourceSwitcher : ITransientDependency + public class PackagePreviewSwitcher : ITransientDependency { - private readonly PackageSourceAdder _packageSourceAdder; + private readonly PackageSourceManager _packageSourceManager; private readonly NpmPackagesUpdater _npmPackagesUpdater; private readonly VoloNugetPackagesVersionUpdater _nugetPackagesVersionUpdater; - public ILogger Logger { get; set; } + public ILogger Logger { get; set; } - public PackageSourceSwitcher(PackageSourceAdder packageSourceAdder, + public PackagePreviewSwitcher(PackageSourceManager packageSourceManager, NpmPackagesUpdater npmPackagesUpdater, VoloNugetPackagesVersionUpdater nugetPackagesVersionUpdater) { - _packageSourceAdder = packageSourceAdder; + _packageSourceManager = packageSourceManager; _npmPackagesUpdater = npmPackagesUpdater; _nugetPackagesVersionUpdater = nugetPackagesVersionUpdater; - Logger = NullLogger.Instance; + Logger = NullLogger.Instance; } public async Task SwitchToPreview(CommandLineArgs commandLineArgs) { - _packageSourceAdder.Add("ABP Nightly", "https://www.myget.org/F/abp-nightly/api/v3/index.json"); + var solutionPath = GetSolutionPath(commandLineArgs); + var solutionFolder = GetSolutionFolder(commandLineArgs); + + await _nugetPackagesVersionUpdater.UpdateSolutionAsync( + solutionPath, + includeReleaseCandidates: true); + + await _npmPackagesUpdater.Update( + solutionFolder, + false, + true); + } + public async Task SwitchToNightlyPreview(CommandLineArgs commandLineArgs) + { var solutionPath = GetSolutionPath(commandLineArgs); var solutionFolder = GetSolutionFolder(commandLineArgs); + _packageSourceManager.Add(solutionFolder, "ABP Nightly", "https://www.myget.org/F/abp-nightly/api/v3/index.json"); + await _nugetPackagesVersionUpdater.UpdateSolutionAsync( solutionPath, true); @@ -48,14 +63,18 @@ namespace Volo.Abp.Cli.ProjectModification var solutionPath = GetSolutionPath(commandLineArgs); var solutionFolder = GetSolutionFolder(commandLineArgs); + _packageSourceManager.Remove(solutionFolder, "ABP Nightly"); + await _nugetPackagesVersionUpdater.UpdateSolutionAsync( solutionPath, false, + false, true); await _npmPackagesUpdater.Update( solutionFolder, false, + false, true); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageSourceAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageSourceAdder.cs deleted file mode 100644 index 3e651b3bf1..0000000000 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageSourceAdder.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.IO; -using System.Xml; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; -using Volo.Abp.DependencyInjection; - -namespace Volo.Abp.Cli.ProjectModification -{ - public class PackageSourceAdder: ITransientDependency - { - public ILogger Logger { get; set; } - - public PackageSourceAdder() - { - Logger = NullLogger.Instance; - } - - public void Add(string sourceKey, string sourceValue) - { - var nugetConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), - "NuGet", "NuGet.Config"); - - if (!File.Exists(nugetConfigPath)) - { - return; - } - - var fileContent = File.ReadAllText(nugetConfigPath); - - if (fileContent.Contains($"\"{sourceValue}\"")) - { - return; - } - - Logger.LogInformation($"Adding \"{sourceValue}\" ({sourceKey}) to nuget sources..."); - - try - { - var doc = new XmlDocument() { PreserveWhitespace = true }; - - doc.Load(GenerateStreamFromString(fileContent)); - - var sourceNodes = doc.SelectNodes("/configuration/packageSources"); - - var newNode = doc.CreateElement("add"); - - var includeAttr = doc.CreateAttribute("key"); - includeAttr.Value = sourceKey; - newNode.Attributes.Append(includeAttr); - - var versionAttr = doc.CreateAttribute("value"); - versionAttr.Value = sourceValue; - newNode.Attributes.Append(versionAttr); - - sourceNodes?[0]?.AppendChild(newNode); - - File.WriteAllText(nugetConfigPath, doc.OuterXml); - } - catch - { - Logger.LogWarning($"Adding \"{sourceValue}\" ({sourceKey}) to nuget sources FAILED."); - } - } - - private static Stream GenerateStreamFromString(string s) - { - var stream = new MemoryStream(); - var writer = new StreamWriter(stream); - writer.Write(s); - writer.Flush(); - stream.Position = 0; - return stream; - } - } -} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageSourceManager.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageSourceManager.cs new file mode 100644 index 0000000000..48c6e80030 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageSourceManager.cs @@ -0,0 +1,126 @@ +using System; +using System.IO; +using System.Xml; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Cli.ProjectModification +{ + public class PackageSourceManager: ITransientDependency + { + public ILogger Logger { get; set; } + + public PackageSourceManager() + { + Logger = NullLogger.Instance; + } + + public void Add(string solutionFolder, string sourceKey, string sourceValue) + { + var nugetConfigPath = GetNugetConfigPath(solutionFolder); + + Logger.LogInformation($"Adding \"{sourceValue}\" ({sourceKey}) to nuget sources..."); + + if (!File.Exists(nugetConfigPath)) + { + File.WriteAllText(nugetConfigPath, "\n" + + "\n" + + " \n" + + " \n" + + $" \n" + + " \n" + + ""); + return; + } + + var fileContent = File.ReadAllText(nugetConfigPath); + + if (fileContent.Contains($"\"{sourceValue}\"")) + { + return; + } + + try + { + var doc = new XmlDocument() { PreserveWhitespace = true }; + + doc.Load(GenerateStreamFromString(fileContent)); + + var sourceNodes = doc.SelectNodes("/configuration/packageSources"); + + var newNode = doc.CreateElement("add"); + + var includeAttr = doc.CreateAttribute("key"); + includeAttr.Value = sourceKey; + newNode.Attributes.Append(includeAttr); + + var versionAttr = doc.CreateAttribute("value"); + versionAttr.Value = sourceValue; + newNode.Attributes.Append(versionAttr); + + sourceNodes?[0]?.AppendChild(newNode); + + File.WriteAllText(nugetConfigPath, doc.OuterXml); + } + catch + { + Logger.LogWarning($"Adding \"{sourceValue}\" ({sourceKey}) to nuget sources FAILED."); + } + } + + public void Remove(string solutionFolder, string sourceKey) + { + var nugetConfigPath = GetNugetConfigPath(solutionFolder); + + if (!File.Exists(nugetConfigPath)) + { + return; + } + + var fileContent = File.ReadAllText(nugetConfigPath); + + if (!fileContent.Contains($"\"{sourceKey}\"")) + { + return; + } + + Logger.LogInformation($"Removing \"{sourceKey}\" from nuget sources..."); + + try + { + var doc = new XmlDocument() { PreserveWhitespace = true }; + + doc.Load(GenerateStreamFromString(fileContent)); + + var nodes = doc.SelectNodes($"/configuration/packageSources/add[@key='{sourceKey}']"); + + if (nodes != null && nodes.Count > 0) + { + nodes[0].ParentNode.RemoveChild(nodes[0]); + } + + File.WriteAllText(nugetConfigPath, doc.OuterXml); + } + catch + { + Logger.LogWarning($"Removing \"{sourceKey}\" from nuget sources FAILED."); + } + } + + private static string GetNugetConfigPath(string solutionFolder) + { + return Path.Combine(solutionFolder, "NuGet.Config"); + } + + private static Stream GenerateStreamFromString(string s) + { + var stream = new MemoryStream(); + var writer = new StreamWriter(stream); + writer.Write(s); + writer.Flush(); + stream.Position = 0; + return stream; + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs index a69957a497..5f1e18efbd 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs @@ -4,6 +4,7 @@ using System.IO; using System.Linq; using System.Net; using System.Threading.Tasks; +using System.Xml; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.Cli.Http; @@ -40,26 +41,36 @@ namespace Volo.Abp.Cli.ProjectModification Logger = NullLogger.Instance; } - public async Task AddAsync(string projectFile, string packageName) + public async Task AddAsync(string projectFile, string packageName, string version = null) { await AddAsync( projectFile, - await FindNugetPackageInfoAsync(packageName) + await FindNugetPackageInfoAsync(packageName), + version ); } - public Task AddAsync(string projectFile, NugetPackageInfo package) + public Task AddAsync(string projectFile, NugetPackageInfo package, string version = null) { - if (File.ReadAllText(projectFile).Contains($"\"{package.Name}\"")) + var projectFileContent = File.ReadAllText(projectFile); + + if (projectFileContent.Contains($"\"{package.Name}\"")) { return Task.CompletedTask; } + if (version == null) + { + version = GetAbpVersionOrNull(projectFileContent); + } + using (DirectoryHelper.ChangeCurrentDirectory(Path.GetDirectoryName(projectFile))) { Logger.LogInformation($"Installing '{package.Name}' package to the project '{Path.GetFileNameWithoutExtension(projectFile)}'..."); - CmdHelper.Run("dotnet", "add package " + package.Name); + var versionOption = version == null ? "" : $" -v {version}"; + + CmdHelper.Run("dotnet", $"add package {package.Name}{versionOption}"); var moduleFiles = ModuleClassFinder.Find(projectFile, "AbpModule"); if (moduleFiles.Count == 0) @@ -80,11 +91,22 @@ namespace Volo.Abp.Cli.ProjectModification return Task.CompletedTask; } - protected virtual async Task FindNugetPackageInfoAsync(string moduleName) + private string GetAbpVersionOrNull(string projectFileContent) + { + var doc = new XmlDocument() { PreserveWhitespace = true }; + + doc.Load(StreamHelper.GenerateStreamFromString(projectFileContent)); + + var nodes = doc.SelectNodes("/Project/ItemGroup/PackageReference[starts-with(@Include, 'Volo.')]"); + + return nodes?[0]?.Attributes?["Version"]?.Value; + } + + protected virtual async Task FindNugetPackageInfoAsync(string packageName) { using (var client = new CliHttpClient()) { - var url = $"{CliUrls.WwwAbpIo}api/app/nugetPackage/byName/?name=" + moduleName; + var url = $"{CliUrls.WwwAbpIo}api/app/nugetPackage/byName/?name=" + packageName; var response = await client.GetAsync(url); @@ -92,7 +114,7 @@ namespace Volo.Abp.Cli.ProjectModification { if (response.StatusCode == HttpStatusCode.NotFound) { - throw new CliUsageException($"'{moduleName}' nuget package could not be found!"); + throw new CliUsageException($"'{packageName}' nuget package could not be found!"); } await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response); @@ -103,4 +125,4 @@ namespace Volo.Abp.Cli.ProjectModification } } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs index 9661dceddd..275bf23c76 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs @@ -25,23 +25,30 @@ namespace Volo.Abp.Cli.ProjectModification Logger = NullLogger.Instance; } - public async Task UpdateSolutionAsync(string solutionPath, bool includePreviews = false, bool switchToStable = false, bool checkAll = false) + public async Task UpdateSolutionAsync(string solutionPath, bool includePreviews = false, bool includeReleaseCandidates = false, bool switchToStable = false, bool checkAll = false) { var projectPaths = ProjectFinder.GetProjectFiles(solutionPath); if (checkAll) { - Task.WaitAll(projectPaths.Select(projectPath => UpdateInternalAsync(projectPath, includePreviews, switchToStable)).ToArray()); + Task.WaitAll(projectPaths.Select(projectPath => UpdateInternalAsync(projectPath, includePreviews, includeReleaseCandidates, switchToStable)).ToArray()); } else { - var latestVersionFromNuget = await _nuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Core"); + var latestVersionFromNuget = await _nuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Core", includeReleaseCandidates : includeReleaseCandidates); + var latestReleaseCandidateVersionFromNuget = await _nuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Core", includeReleaseCandidates : true); var latestVersionFromMyGet = await GetLatestVersionFromMyGet("Volo.Abp.Core"); async Task UpdateAsync(string filePath) { var fileContent = File.ReadAllText(filePath); - var updatedContent = await UpdateVoloPackagesAsync(fileContent, includePreviews, switchToStable, latestVersionFromNuget, latestVersionFromMyGet); + var updatedContent = await UpdateVoloPackagesAsync(fileContent, + includePreviews, + includeReleaseCandidates, + switchToStable, + latestVersionFromNuget, + latestReleaseCandidateVersionFromNuget, + latestVersionFromMyGet); File.WriteAllText(filePath, updatedContent); } @@ -50,33 +57,47 @@ namespace Volo.Abp.Cli.ProjectModification } } - public async Task UpdateProjectAsync(string projectPath, bool includePreviews = false, bool switchToStable = false, bool checkAll = false) + public async Task UpdateProjectAsync(string projectPath, bool includeNightlyPreviews = false, bool includeReleaseCandidates = false, bool switchToStable = false, bool checkAll = false) { if (checkAll) { - await UpdateInternalAsync(projectPath, includePreviews, switchToStable); + await UpdateInternalAsync(projectPath, includeNightlyPreviews, includeReleaseCandidates, switchToStable); } else { var latestVersionFromNuget = await _nuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Core"); + var latestReleaseCandidateVersionFromNuget = await _nuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Core", includeReleaseCandidates : true); var latestVersionFromMyGet = await GetLatestVersionFromMyGet("Volo.Abp.Core"); var fileContent = File.ReadAllText(projectPath); - var updatedContent = await UpdateVoloPackagesAsync(fileContent, includePreviews, switchToStable, latestVersionFromNuget, latestVersionFromMyGet); + + var updatedContent = await UpdateVoloPackagesAsync(fileContent, + includeNightlyPreviews, + includeReleaseCandidates, + switchToStable, + latestVersionFromNuget, + latestReleaseCandidateVersionFromNuget, + latestVersionFromMyGet); File.WriteAllText(projectPath, updatedContent); } } - protected virtual async Task UpdateInternalAsync(string projectPath, bool includePreviews = false, bool switchToStable = false) + protected virtual async Task UpdateInternalAsync(string projectPath, bool includeNightlyPreviews = false, bool includeReleaseCandidates = false, bool switchToStable = false) { var fileContent = File.ReadAllText(projectPath); - var updatedContent = await UpdateVoloPackagesAsync(fileContent, includePreviews, switchToStable); + var updatedContent = await UpdateVoloPackagesAsync(fileContent, includeNightlyPreviews, includeReleaseCandidates, switchToStable); File.WriteAllText(projectPath, updatedContent); } - private async Task UpdateVoloPackagesAsync(string content, bool includePreviews = false, bool switchToStable = false, SemanticVersion latestNugetVersion = null, string latestMyGetVersion = null) + private async Task UpdateVoloPackagesAsync(string content, + bool includeNightlyPreviews = false, + bool includeReleaseCandidates = false, + bool switchToStable = false, + SemanticVersion latestNugetVersion = null, + SemanticVersion latestNugetReleaseCandidateVersion = null, + string latestMyGetVersion = null) { string packageId = null; @@ -108,7 +129,7 @@ namespace Volo.Abp.Cli.ProjectModification Logger.LogDebug("Checking package: \"{0}\" - Current version: {1}", packageId, currentSemanticVersion); - if (includePreviews || (currentVersion.Contains("-preview") && !switchToStable)) + if ((includeNightlyPreviews || (currentVersion.Contains("-preview") && !switchToStable)) && !includeReleaseCandidates) { var latestVersion = latestMyGetVersion ?? await GetLatestVersionFromMyGet(packageId); @@ -124,9 +145,17 @@ namespace Volo.Abp.Cli.ProjectModification } else { - var latestVersion = latestNugetVersion ?? await _nuGetService.GetLatestVersionOrNullAsync(packageId); + SemanticVersion latestVersion; + if (currentSemanticVersion.IsPrerelease && !switchToStable) + { + latestVersion = latestNugetReleaseCandidateVersion ?? await _nuGetService.GetLatestVersionOrNullAsync(packageId, includeReleaseCandidates: true); + } + else + { + latestVersion = latestNugetVersion ?? await _nuGetService.GetLatestVersionOrNullAsync(packageId, includeReleaseCandidates: includeReleaseCandidates); + } - if (latestVersion != null && (currentVersion.Contains("-preview") || currentSemanticVersion < latestVersion)) + if (latestVersion != null && (currentSemanticVersion < latestVersion || (currentSemanticVersion.IsPrerelease && switchToStable))) { Logger.LogInformation("Updating package \"{0}\" from v{1} to v{2}.", packageId, currentSemanticVersion.ToString(), latestVersion.ToString()); versionAttribute.Value = latestVersion.ToString(); diff --git a/modules/docs/src/Volo.Docs.Application/Volo/Docs/Projects/ProjectAppService.cs b/modules/docs/src/Volo.Docs.Application/Volo/Docs/Projects/ProjectAppService.cs index 04b96f9e6f..2284804143 100644 --- a/modules/docs/src/Volo.Docs.Application/Volo/Docs/Projects/ProjectAppService.cs +++ b/modules/docs/src/Volo.Docs.Application/Volo/Docs/Projects/ProjectAppService.cs @@ -86,11 +86,6 @@ namespace Volo.Docs.Projects } } - if (versions.Any() && !string.IsNullOrEmpty(project.LatestVersionBranchName)) - { - versions.First().Name = project.LatestVersionBranchName; - } - return versions; } @@ -126,4 +121,4 @@ namespace Volo.Docs.Projects ); } } -} \ No newline at end of file +} diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml index 90a754b1a9..71c7d4790c 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml @@ -53,7 +53,7 @@