From 9fc00af0abb27d06c5f8f27004272305ff3334c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Fri, 20 Oct 2017 09:29:19 +0200 Subject: [PATCH] Update the samples to use WebHost.CreateDefaultBuilder() --- samples/Mvc.Client/Mvc.Client.csproj | 1 + samples/Mvc.Client/Program.cs | 24 +++++-------------- .../Mvc.Client/Properties/launchSettings.json | 8 ++++--- samples/Mvc.Server/Mvc.Server.csproj | 1 + samples/Mvc.Server/Program.cs | 24 +++++-------------- .../Mvc.Server/Properties/launchSettings.json | 8 ++++--- 6 files changed, 24 insertions(+), 42 deletions(-) diff --git a/samples/Mvc.Client/Mvc.Client.csproj b/samples/Mvc.Client/Mvc.Client.csproj index 087e662a..1c09d535 100644 --- a/samples/Mvc.Client/Mvc.Client.csproj +++ b/samples/Mvc.Client/Mvc.Client.csproj @@ -7,6 +7,7 @@ + diff --git a/samples/Mvc.Client/Program.cs b/samples/Mvc.Client/Program.cs index 3c4e0ad3..a06f691c 100644 --- a/samples/Mvc.Client/Program.cs +++ b/samples/Mvc.Client/Program.cs @@ -1,28 +1,16 @@ -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; namespace Mvc.Client { public static class Program { - public static void Main(string[] args) - { - var configuration = new ConfigurationBuilder() - .AddEnvironmentVariables() - .AddCommandLine(args) - .Build(); + public static void Main(string[] args) => + BuildWebHost(args).Run(); - var host = new WebHostBuilder() - .ConfigureLogging(options => options.AddConsole()) - .ConfigureLogging(options => options.AddDebug()) - .UseConfiguration(configuration) - .UseIISIntegration() - .UseKestrel() + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) .UseStartup() .Build(); - - host.Run(); - } } } diff --git a/samples/Mvc.Client/Properties/launchSettings.json b/samples/Mvc.Client/Properties/launchSettings.json index 53029f9e..ea287081 100644 --- a/samples/Mvc.Client/Properties/launchSettings.json +++ b/samples/Mvc.Client/Properties/launchSettings.json @@ -15,11 +15,13 @@ "ASPNETCORE_ENVIRONMENT": "Development" } }, - "web": { - "commandName": "web", + "Mvc.Client": { + "commandName": "Project", + "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "http://localhost:53507/" } } } \ No newline at end of file diff --git a/samples/Mvc.Server/Mvc.Server.csproj b/samples/Mvc.Server/Mvc.Server.csproj index 8c129d28..5809a301 100644 --- a/samples/Mvc.Server/Mvc.Server.csproj +++ b/samples/Mvc.Server/Mvc.Server.csproj @@ -28,6 +28,7 @@ + diff --git a/samples/Mvc.Server/Program.cs b/samples/Mvc.Server/Program.cs index b1c8ae68..70e9ba9f 100644 --- a/samples/Mvc.Server/Program.cs +++ b/samples/Mvc.Server/Program.cs @@ -1,28 +1,16 @@ -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; namespace Mvc.Server { public static class Program { - public static void Main(string[] args) - { - var configuration = new ConfigurationBuilder() - .AddEnvironmentVariables() - .AddCommandLine(args) - .Build(); + public static void Main(string[] args) => + BuildWebHost(args).Run(); - var host = new WebHostBuilder() - .ConfigureLogging(options => options.AddConsole()) - .ConfigureLogging(options => options.AddDebug()) - .UseConfiguration(configuration) - .UseIISIntegration() - .UseKestrel() + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) .UseStartup() .Build(); - - host.Run(); - } } } diff --git a/samples/Mvc.Server/Properties/launchSettings.json b/samples/Mvc.Server/Properties/launchSettings.json index fd1157ab..0d172e93 100644 --- a/samples/Mvc.Server/Properties/launchSettings.json +++ b/samples/Mvc.Server/Properties/launchSettings.json @@ -15,11 +15,13 @@ "ASPNETCORE_ENVIRONMENT": "Development" } }, - "web": { - "commandName": "web", + "Mvc.Server": { + "commandName": "Project", + "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "http://localhost:54540/" } } } \ No newline at end of file