dotnet / dotnet/sdk

UpdateServiceWorkerFileWithVersion task runs after static asset compression

Open
#50,001 2 comments 1 reaction 0 assignees View on GitHub
Area-AspNetCore untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### 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`:
```xml

$(CompressionExcludePatterns);**/service-worker.js

```

### Further technical details
details of dotnet --info


.NET SDK:
Version: 9.0.200
Commit: 90e8b202f2
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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.