From b02ee7fddc4157145175f163ab9373ab54fc2335 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 30 Nov 2020 11:13:48 +0300 Subject: [PATCH] Add no-random-port parameter to ABP CLI when generating a new solution resolves https://github.com/abpframework/abp/issues/6378 --- docs/en/CLI.md | 1 + .../Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs | 1 + .../Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs | 5 +++++ .../ProjectBuilding/Templates/Module/ModuleTemplateBase.cs | 5 +++++ 4 files changed, 12 insertions(+) diff --git a/docs/en/CLI.md b/docs/en/CLI.md index a119770286..d51dd91b5d 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -107,6 +107,7 @@ abp new Acme.BookStore * `--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). * `--local-framework-ref --abp-path`: Uses local projects references to the ABP framework instead of using the NuGet packages. This can be useful if you download the ABP Framework source code and have a local reference to the framework from your application. +* `--no-random-port`: Uses template's default ports. ### update 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 39ecdb8183..259a1eacf8 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 @@ -230,6 +230,7 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine("-cs|--connection-string (your database connection string)"); sb.AppendLine("--tiered (if supported by the template)"); sb.AppendLine("--no-ui (if supported by the template)"); + sb.AppendLine("----no-random-port (Use template's default ports)"); sb.AppendLine("--separate-identity-server (if supported by the template)"); sb.AppendLine("--local-framework-ref --abp-path (keeps local references to projects instead of replacing with NuGet package references)"); sb.AppendLine(""); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs index 8846473d96..00a42491fe 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs @@ -173,6 +173,11 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App private static void RandomizeSslPorts(ProjectBuildContext context, List steps) { + if (context.BuildArgs.ExtraProperties.ContainsKey("no-random-port")) + { + return; + } + steps.Add(new TemplateRandomSslPortStep( new List { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs index 78fd522265..664ffd182b 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs @@ -54,6 +54,11 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.Module private void RandomizeSslPorts(ProjectBuildContext context, List steps) { + if (context.BuildArgs.ExtraProperties.ContainsKey("no-random-port")) + { + return; + } + steps.Add(new TemplateRandomSslPortStep(new List { "https://localhost:44300",