Blazor WebAssembly fingerprint not applied in certain publish scenarios
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
When running `dotnet restore`, `dotnet build` and ``dotnet publish` with certain parameters, the assets fingerprint is not applied to the published index.html file.
### Expected Behavior
In the index.html file, the placeholder `#[.{fingerprint}]` should be replaced with the actual fingerprint.
### Steps To Reproduce
Run the following commands:
```powershell
dotnet new blazorwasm -f net10.0 -n wasm-publish
cd .\wasm-publish\
dotnet restore --verbosity Normal /p:Configuration=Release
dotnet build wasm-publish.sln --configuration Release --no-restore
dotnet publish wasm-publish.csproj --configuration Release --no-build -p:BuildProjectReferences=false
```
Check the published index.html file: `bin\Release\net10.0\publish\wwwroot\index.html`
Notice that the blazor.webassembly.js script reference has not been fingerprinted:
```html
```
This will result in the browser not being able to find the script.
If you run `dotnet publish` without any arguments, the fingerprint is applied:
```powershell
dotnet publish wasm-publish.csproj --configuration Release
```
```html
```
### Exceptions (if any)
_No response_
### .NET Version
10.0.100
### Anything else?
I have tried this on Windows 11 and a pipeline agent with Ubuntu 24.04.3.
.NET SDK version 10.0.100
wasm-tools is installed
Contributor guide
Research direction
Reproduce the issue with the listed dotnet restore, build, and publish commands, then compare the generated bin\Release\net10.0\publish\wwwroot\index.html with an argument-free publish. Start by tracing why the #[.{fingerprint}] placeholder remains in index.html; done means the published file contains the actual fingerprint and the blazor.webassembly.js reference resolves.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, wasm
- Domain
- build-system, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100