[wasm] Misc fixes (#81320)
authorAnkit Jain <radical@gmail.com>
Mon, 30 Jan 2023 16:43:38 +0000 (11:43 -0500)
committerGitHub <noreply@github.com>
Mon, 30 Jan 2023 16:43:38 +0000 (11:43 -0500)
* [wasm] Catch warnings in wasm template project builds

This will help catch warnings like the ones fixed in https://github.com/dotnet/runtime/pull/77704

* [wasm][debugger] tests: fix warning

`[18:17:44] warn: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[16] The WebRootPath was not found: /datadisks/disk1/work/B4180A14/w/992108AB/e/DebuggerTestSuite/wwwroot.  Static files may be unavailable.`

src/mono/wasm/Wasm.Build.Tests/BuildTestBase.cs
src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessStartup.cs

index 9ebc210..f0b1776 100644 (file)
@@ -493,10 +493,14 @@ namespace Wasm.Build.Tests
                     .EnsureSuccessful();
 
             string projectfile = Path.Combine(_projectDir!, $"{id}.csproj");
+            string extraProperties = string.Empty;
+            extraProperties += "<TreatWarningsAsErrors>true</TreatWarningsAsErrors>";
             if (runAnalyzers)
-                AddItemsPropertiesToProject(projectfile, "<RunAnalyzers>true</RunAnalyzers>");
+                extraProperties += "<RunAnalyzers>true</RunAnalyzers>";
             if (UseWebcil)
-                AddItemsPropertiesToProject(projectfile, "<WasmEnableWebcil>true</WasmEnableWebcil>");
+                extraProperties += "<WasmEnableWebcil>true</WasmEnableWebcil>";
+            AddItemsPropertiesToProject(projectfile, extraProperties);
+
             return projectfile;
         }
 
index e71411c..01a3d47 100644 (file)
@@ -81,7 +81,6 @@ namespace DebuggerTests
             this._loggerFactory = loggerFactory;
 
             app.UseWebSockets();
-            app.UseStaticFiles();
 
             TestHarnessOptions options = optionsAccessor.CurrentValue;