Blazor Server "blazor.web.js / blazor.server.js not found" at build in CI
A Blazor app references _framework/blazor.web.js (or blazor.server.js). These are produced by the static web assets pipeline at build/publish. If that pipeline did not run in CI, the script is absent from the publish output.
What this error means
Publish output is missing _framework/blazor.web.js (or blazor.server.js), or a later validation step reports the framework script path is not found after build.
error : Static web asset '_framework/blazor.web.js' was not found in the
publish output. The StaticWebAssets build target may not have run.Common causes
Build skipped the static web assets target
Calling a low-level compile path or copying bin/ directly bypasses the static web assets target that emits the framework scripts.
Publishing the wrong project in the solution
CI published a class library or the wrong app project, so the host project that emits _framework scripts was never built for output.
How to fix it
Publish the web project so static assets build
- Target the host web project explicitly in
dotnet publish. - Use publish (not a raw file copy) so the static web assets target runs.
- Verify
_frameworkscripts exist in the output.
dotnet publish ./src/WebApp/WebApp.csproj -c Release -o ./publish
test -f ./publish/wwwroot/_framework/blazor.web.jsDo not copy bin output as the deploy artifact
Use the publish output as the artifact so the assembled _framework scripts are included.
- uses: actions/upload-artifact@v4
with:
path: ./publishHow to prevent it
- Always deploy
dotnet publishoutput, not rawbin/. - Publish the correct host project in a multi-project solution.
- Add a check that framework scripts exist before deploy.