aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Blazor WebAssembly fingerprint not applied in certain publish scenarios

Open fredrik-instech opened this issue 1 month ago • 5 comments

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

fredrik-instech avatar Nov 26 '25 15:11 fredrik-instech

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

HeinA-NM avatar Dec 06 '25 14:12 HeinA-NM

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.

th3oth3rjak3 avatar Dec 09 '25 05:12 th3oth3rjak3

I'm having the same issue.

PaulTodd avatar Dec 10 '25 16:12 PaulTodd

This issue is probably related: https://github.com/dotnet/aspnetcore/issues/64709

davidroth avatar Dec 10 '25 18:12 davidroth

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>

HeinA-NM avatar Dec 11 '25 05:12 HeinA-NM