diff --git a/.vscode/launch.json b/.vscode/launch.json index 4af80c46132..913be3c90f0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -27,19 +27,9 @@ "ASPNETCORE_ENVIRONMENT": "Development" }, "stopAtEntry": false, - "launchBrowser": { - "enabled": true, - "args": "${auto-detect-url}", - "windows": { - "command": "cmd.exe", - "args": "/C start http://localhost:5000" - }, - "osx": { - "command": "open" - }, - "linux": { - "command": "xdg-open" - } + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" } }, { @@ -54,13 +44,9 @@ "ASPNETCORE_ENVIRONMENT": "Development" }, "stopAtEntry": false, - "launchBrowser": { - "enabled": true, - "args": "${auto-detect-url}", - "windows": { - "command": "cmd.exe", - "args": "/C start http://localhost:5000" - } + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" } }, { @@ -82,13 +68,9 @@ "ASPNETCORE_ENVIRONMENT": "Development" }, "stopAtEntry": false, - "launchBrowser": { - "enabled": true, - "args": "${auto-detect-url}", - "windows": { - "command": "cmd.exe", - "args": "/C start http://localhost:5000" - } + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" } }, { @@ -104,13 +86,9 @@ "ASPNETCORE_ENVIRONMENT": "Development" }, "stopAtEntry": false, - "launchBrowser": { - "enabled": true, - "args": "${auto-detect-url}", - "windows": { - "command": "cmd.exe", - "args": "/C start http://localhost:5000" - } + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)" } }, { diff --git a/src/OrchardCore.Cms.Web/Program.cs b/src/OrchardCore.Cms.Web/Program.cs index f642bc08204..b0e15cfdbe4 100644 --- a/src/OrchardCore.Cms.Web/Program.cs +++ b/src/OrchardCore.Cms.Web/Program.cs @@ -1,4 +1,3 @@ -using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; @@ -8,16 +7,18 @@ namespace OrchardCore.Cms.Web { public class Program { - public static Task Main(string[] args) - => BuildHost(args).RunAsync(); + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } - public static IHost BuildHost(string[] args) => + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureLogging(logging => logging.ClearProviders()) - .ConfigureWebHostDefaults(webBuilder => webBuilder - .UseStartup() - .UseNLogWeb()) - .Build() - ; + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + webBuilder.UseNLogWeb(); + }); } } diff --git a/src/OrchardCore.Mvc.Web/Program.cs b/src/OrchardCore.Mvc.Web/Program.cs index 05e625f0fda..e32ca4a5b76 100644 --- a/src/OrchardCore.Mvc.Web/Program.cs +++ b/src/OrchardCore.Mvc.Web/Program.cs @@ -1,4 +1,3 @@ -using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; @@ -6,12 +5,16 @@ namespace OrchardCore.Mvc.Web { public class Program { - public static Task Main(string[] args) - => BuildHost(args).RunAsync(); + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } - public static IHost BuildHost(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup()) - .Build(); + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); } } diff --git a/src/Templates/OrchardCore.ProjectTemplates/content/OrchardCore.Templates.Cms.Web/Program.cs b/src/Templates/OrchardCore.ProjectTemplates/content/OrchardCore.Templates.Cms.Web/Program.cs index edb72f62c65..113edb05686 100644 --- a/src/Templates/OrchardCore.ProjectTemplates/content/OrchardCore.Templates.Cms.Web/Program.cs +++ b/src/Templates/OrchardCore.ProjectTemplates/content/OrchardCore.Templates.Cms.Web/Program.cs @@ -1,5 +1,4 @@ using System; -using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; @@ -14,10 +13,12 @@ namespace OrchardCore.Templates.Cms.Web { public class Program { - public static Task Main(string[] args) - => BuildHost(args).RunAsync(); + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } - public static IHost BuildHost(string[] args) => + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureLogging(logging => logging.ClearProviders()) #if (UseSerilog) @@ -27,11 +28,12 @@ public static IHost BuildHost(string[] args) => .Enrich.FromLogContext(); }) #endif - .ConfigureWebHostDefaults(webBuilder => webBuilder + .ConfigureWebHostDefaults(webBuilder => + { #if (UseNLog) - .UseNLogWeb() + webBuilder.UseNLogWeb(); #endif - .UseStartup() - ).Build(); + webBuilder.UseStartup(); + }); } } diff --git a/src/Templates/OrchardCore.ProjectTemplates/content/OrchardCore.Templates.Mvc.Web/Program.cs b/src/Templates/OrchardCore.ProjectTemplates/content/OrchardCore.Templates.Mvc.Web/Program.cs index cd8c4a7cdc3..77897f99e39 100644 --- a/src/Templates/OrchardCore.ProjectTemplates/content/OrchardCore.Templates.Mvc.Web/Program.cs +++ b/src/Templates/OrchardCore.ProjectTemplates/content/OrchardCore.Templates.Mvc.Web/Program.cs @@ -1,4 +1,3 @@ -using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; @@ -6,13 +5,16 @@ namespace OrchardCore.Templates.Mvc.Web { public class Program { - public static Task Main(string[] args) - => BuildHost(args).RunAsync(); + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } - public static IHost BuildHost(string[] args) - => Host.CreateDefaultBuilder(args) + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => - webBuilder.UseStartup()) - .Build(); + { + webBuilder.UseStartup(); + }); } } diff --git a/src/Templates/OrchardCore.ProjectTemplates/content/OrchardCore.Templates.Mvc.Web/Properties/launchSettings.json b/src/Templates/OrchardCore.ProjectTemplates/content/OrchardCore.Templates.Mvc.Web/Properties/launchSettings.json index 8a6b6e9005d..8be95021879 100644 --- a/src/Templates/OrchardCore.ProjectTemplates/content/OrchardCore.Templates.Mvc.Web/Properties/launchSettings.json +++ b/src/Templates/OrchardCore.ProjectTemplates/content/OrchardCore.Templates.Mvc.Web/Properties/launchSettings.json @@ -1,7 +1,7 @@ { "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, + "windowsAuthentication": false, + "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:8080", "sslPort": 44300 @@ -15,7 +15,7 @@ "ASPNETCORE_ENVIRONMENT": "Development" } }, - "OrchardCore.Templates.Cms.Web": { + "OrchardCore.Templates.Mvc.Web": { "commandName": "Project", "launchBrowser": true, "applicationUrl": "https://localhost:5001;http://localhost:5000", diff --git a/test/OrchardCore.Tests.Pages/OrchardCore.Application.Pages/Program.cs b/test/OrchardCore.Tests.Pages/OrchardCore.Application.Pages/Program.cs index 71b19562148..5c3c9d26a24 100644 --- a/test/OrchardCore.Tests.Pages/OrchardCore.Application.Pages/Program.cs +++ b/test/OrchardCore.Tests.Pages/OrchardCore.Application.Pages/Program.cs @@ -1,4 +1,3 @@ -using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; @@ -6,13 +5,16 @@ namespace OrchardCore.Application.Pages { public class Program { - public static Task Main(string[] args) - => BuildHost(args).RunAsync(); + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } - public static IHost BuildHost(string[] args) - => Host.CreateDefaultBuilder(args) + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => - webBuilder.UseStartup()) - .Build(); + { + webBuilder.UseStartup(); + }); } }