Open LostBeard opened 4 hours ago
One workaround is to disable compression and the publish
builds will succeed.
In the Blazor WASM project's .csproj
<PropertyGroup>
<CompressionEnabled>false</CompressionEnabled>
</PropertyGroup>
Another is to use .Net 8 instead of .Net 9 as the issue does not occur in .Net 8.
Description
Issue
The .Net 9 Blazor WASM compression build task,
ApplyCompressionNegotiation
, fails due to an unknown issue handling Razor Class Library Nuget packages that use<StaticWebAssetBasePath>/</StaticWebAssetBasePath>
when referenced by another Razor Class LibraryReproduction Steps
Steps to reproduce
<StaticWebAssetBasePath>/</StaticWebAssetBasePath>
in its.csproj
.You get an exception similar to:
A workaround that will enable a publish build is to modify the
.csproj
of the Nuget package project.Changing:
<StaticWebAssetBasePath>/</StaticWebAssetBasePath>
To:
<StaticWebAssetBasePath>/./</StaticWebAssetBasePath>
!! IMPORTANT The above workaround breaks debugging. Assets from the Nuget package will be correctly added to publish builds but will fail to load in debug builds.
This issue started as a report about an issue (#4) with SpawnDev.BlazorJS.WebWorkers.
Repo: WebWorkers.Issue4
Repo demo projects
The projects in this repo demonstrate this bug.
RazorClassLibrary2 is the project that needs to be packaged as a Nuget package and that package (not the project) referenced by RazorClassLibrary1.
If
<StaticWebAssetBasePath>
is set to/
in the referenced RazorClassLibrary2 Nuget package, thepublish
ofWebWorkers.Issue4
will fail.Using a RazorClassLibrary2 Nuget package with
<StaticWebAssetBasePath>/./</StaticWebAssetBasePath>
and the publish succeeds. But debugging will fail (404 for the Nuget web assets).Expected behavior
I expected
StaticWebAssetBasePath
to work in .Net 9 as it did in .Net 8. This issue did not exist in .Net 8.Actual behavior
publish
builds fail with the errorEndpoints not found for compressed asset:
Regression?
No response
Known Workarounds
Disable compression with
<CompressionEnabled>false</CompressionEnabled>
in app.csproj
.Configuration
dotnet --info
.NET SDK: Version: 9.0.100 Commit: 59db016f11 Workload version: 9.0.100-manifests.4a280210 MSBuild version: 17.12.7+5b8665660 Runtime Environment: OS Name: Windows OS Version: 10.0.19045 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\9.0.100\ .NET workloads installed: [android] Installation Source: SDK 9.0.100, VS 17.13.35507.96 Manifest Version: 35.0.7/9.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.android\35.0.7\WorkloadManifest.json Install Type: Msi [aspire] Installation Source: SDK 9.0.100, VS 17.11.35327.3 Manifest Version: 8.2.2/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json Install Type: Msi [ios] Installation Source: SDK 9.0.100, VS 17.13.35507.96 Manifest Version: 18.1.9163/9.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.ios\18.1.9163\WorkloadManifest.json Install Type: Msi [maccatalyst] Installation Source: SDK 9.0.100, VS 17.13.35507.96 Manifest Version: 18.1.9163/9.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maccatalyst\18.1.9163\WorkloadManifest.json Install Type: Msi [maui-windows] Installation Source: SDK 9.0.100, VS 17.13.35507.96 Manifest Version: 9.0.0/9.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maui\9.0.0\WorkloadManifest.json Install Type: Msi [wasm-tools] Installation Source: SDK 9.0.100 Manifest Version: 9.0.0/9.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.current\9.0.0\WorkloadManifest.json Install Type: Msi [wasm-tools-net8] Installation Source: SDK 9.0.100 Manifest Version: 9.0.0/9.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.net8\9.0.0\WorkloadManifest.json Install Type: Msi Configured to use loose manifests when installing new manifests. Host: Version: 9.0.0 Architecture: x64 Commit: 9d5a6a9aa4 .NET SDKs installed: 6.0.102 [C:\Program Files\dotnet\sdk] 6.0.202 [C:\Program Files\dotnet\sdk] 6.0.300 [C:\Program Files\dotnet\sdk] 6.0.302 [C:\Program Files\dotnet\sdk] 7.0.100-rc.1.22431.12 [C:\Program Files\dotnet\sdk] 7.0.102 [C:\Program Files\dotnet\sdk] 7.0.200 [C:\Program Files\dotnet\sdk] 8.0.101 [C:\Program Files\dotnet\sdk] 8.0.204 [C:\Program Files\dotnet\sdk] 8.0.303 [C:\Program Files\dotnet\sdk] 8.0.401 [C:\Program Files\dotnet\sdk] 8.0.403 [C:\Program Files\dotnet\sdk] 9.0.100-rc.2.24474.11 [C:\Program Files\dotnet\sdk] 9.0.100 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.0-rc.1.22427.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.0-rc.1.22426.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.0-rc.1.22427.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 9.0.0-rc.2.24474.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation] Environment variables: Not set global.json file: Not found