Describe the bug
The UpdateServiceWorkerFileWithVersion task runs after static asset compression. This causes a content mismatch between the compressed and uncompressed versions of the wwwroot/service-worker.js file.
To Reproduce
- Run
dotnet publish in an ASP.NET blazor wasm project with service worker / PWA support enabled
- Compare decompressed contents of
service-worker.js.br with service-worker.js
- Decompressed version doesn't contain
/* Manifest version: drLIYYR0 */ header (or similar)
Workaround
Place the following in the .csproj or .Build.props:
<PropertyGroup>
<CompressionExcludePatterns>$(CompressionExcludePatterns);**/service-worker.js</CompressionExcludePatterns>
</PropertyGroup>
Further technical details
details of dotnet --info
.NET SDK:
Version: 9.0.200
Commit: 90e8b20
Workload version: 9.0.200-manifests.183aaee6
MSBuild version: 17.13.8+cbc39bea8
Runtime Environment:
OS Name: Mac OS X
OS Version: 15.5
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/9.0.200/
.NET workloads installed:
[wasm-tools]
Installation Source: SDK 9.0.200
Manifest Version: 9.0.7/9.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.workload.mono.toolchain.current/9.0.7/WorkloadManifest.json
Install Type: FileBased
Configured to use loose manifests when installing new manifests.
Host:
Version: 10.0.0-preview.5.25277.114
Architecture: arm64
Commit: ddf39a1b46
.NET SDKs installed:
8.0.401 [/usr/local/share/dotnet/sdk]
9.0.200 [/usr/local/share/dotnet/sdk]
10.0.100-preview.5.25277.114 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0-preview.5.25277.114 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-preview.5.25277.114 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
/Users/zotan/Projects/Iceshrimp.NET/global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Describe the bug
The
UpdateServiceWorkerFileWithVersiontask runs after static asset compression. This causes a content mismatch between the compressed and uncompressed versions of thewwwroot/service-worker.jsfile.To Reproduce
dotnet publishin an ASP.NET blazor wasm project with service worker / PWA support enabledservice-worker.js.brwithservice-worker.js/* Manifest version: drLIYYR0 */header (or similar)Workaround
Place the following in the
.csprojor.Build.props:Further technical details
details of dotnet --info
.NET SDK: Version: 9.0.200 Commit: 90e8b20 Workload version: 9.0.200-manifests.183aaee6 MSBuild version: 17.13.8+cbc39bea8
Runtime Environment:
OS Name: Mac OS X
OS Version: 15.5
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/9.0.200/
.NET workloads installed:
[wasm-tools]
Installation Source: SDK 9.0.200
Manifest Version: 9.0.7/9.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.workload.mono.toolchain.current/9.0.7/WorkloadManifest.json
Install Type: FileBased
Configured to use loose manifests when installing new manifests.
Host:
Version: 10.0.0-preview.5.25277.114
Architecture: arm64
Commit: ddf39a1b46
.NET SDKs installed:
8.0.401 [/usr/local/share/dotnet/sdk]
9.0.200 [/usr/local/share/dotnet/sdk]
10.0.100-preview.5.25277.114 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0-preview.5.25277.114 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-preview.5.25277.114 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
/Users/zotan/Projects/Iceshrimp.NET/global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download