diff --git a/src/Components/WebAssembly/DevServer/src/Microsoft.AspNetCore.Components.WebAssembly.DevServer.csproj b/src/Components/WebAssembly/DevServer/src/Microsoft.AspNetCore.Components.WebAssembly.DevServer.csproj index 1235b919e8e15a2df87f2a3547bf3e3d72df7223..ee374b9a6628c9820d01d661b1867b5b2ca77195 100644 --- a/src/Components/WebAssembly/DevServer/src/Microsoft.AspNetCore.Components.WebAssembly.DevServer.csproj +++ b/src/Components/WebAssembly/DevServer/src/Microsoft.AspNetCore.Components.WebAssembly.DevServer.csproj @@ -32,7 +32,6 @@ <ItemGroup> <NuspecProperty Include="publishDir=$(PublishDir)" /> <NuspecProperty Include="componentsrootdir=..\..\..\" /> - <NuspecProperty Include="blazorversion=$(PackageVersion)" /> </ItemGroup> </Project> diff --git a/src/Components/WebAssembly/DevServer/src/Server/Program.cs b/src/Components/WebAssembly/DevServer/src/Server/Program.cs index 1335a9958d774bd4216c6fd6fab94fdc3b734788..aec2b594e38f3c78ba43a25cc353af0a2a5ed92d 100644 --- a/src/Components/WebAssembly/DevServer/src/Server/Program.cs +++ b/src/Components/WebAssembly/DevServer/src/Server/Program.cs @@ -1,15 +1,13 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; -using System.Threading; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Components.WebAssembly.DevServer.Server { @@ -27,17 +25,21 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.DevServer.Server /// </summary> public static IHost BuildWebHost(string[] args) => Host.CreateDefaultBuilder(args) - .ConfigureHostConfiguration(cb => { + .ConfigureHostConfiguration(config => + { var applicationPath = args.SkipWhile(a => a != "--applicationpath").Skip(1).FirstOrDefault(); - var name = Path.ChangeExtension(applicationPath,".StaticWebAssets.xml"); + var applicationDirectory = Path.GetDirectoryName(applicationPath); + var name = Path.ChangeExtension(applicationPath, ".StaticWebAssets.xml"); - if (name != null) + var inMemoryConfiguration = new Dictionary<string, string> { - cb.AddInMemoryCollection(new Dictionary<string, string> - { - [WebHostDefaults.StaticWebAssetsKey] = name - }); - } + ["Logging:LogLevel:Microsoft"] = "Warning", + ["Logging:LogLevel:Microsoft.Hosting.Lifetime"] = "Information", + [WebHostDefaults.StaticWebAssetsKey] = name, + }; + + config.AddInMemoryCollection(inMemoryConfiguration); + config.AddJsonFile(Path.Combine(applicationDirectory, "blazor-devserversettings.json"), optional: true, reloadOnChange: true); }) .ConfigureWebHostDefaults(webBuilder => {