Blazor WebAssembly fingerprint not applied in certain publish scenarios
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:
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:
<script src="_framework/blazor.webassembly#[.{fingerprint}].js"></script>
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:
dotnet publish wasm-publish.csproj --configuration Release
<script src="_framework/blazor.webassembly.66stpp682q.js"></script>
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
I can confirm. I'm getting a 404 on /_framework/blazor.webassembly. My fingerprint is also not applied
- task: DotNetCoreCLI@2 displayName: 'Building Application' inputs: command: publish publishWebProjects: false projects: '**/Feedmaster.ServiceHost.csproj' arguments: '--configuration $(buildConfiguration) --output $(build.artifactStagingDirectory)' zipAfterPublish: true
Yeah I ended up rolling back to .net 8 because I couldn't get it to publish successfully. Looking forward to a fix. Mine occurred when doing a publish from the server project which is hosting a standalone blazor WASM app.
I'm having the same issue.
This issue is probably related: https://github.com/dotnet/aspnetcore/issues/64709
This issue can be bypassed by adding the following in the Blazor WASM app .csproj
<StaticWebAssetFingerprintingEnabled>false</StaticWebAssetFingerprintingEnabled> <StaticWebAssetsFingerprintContent>false</StaticWebAssetsFingerprintContent>
and removing the fingerprint on the blazor webassembly js in index.html
<script src="_framework/blazor.webassembly.js"></script>