Skip to content
Latchkey

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.

dotnet
error : Static web asset '_framework/blazor.web.js' was not found in the
publish output. The StaticWebAssets build target may not have run.

Diagnose it: SDK version and restore first

Most .NET CI failures are an SDK mismatch or a restore that did not happen. global.json pins the SDK, and if the runner does not have that exact version the failure message is about the project rather than the SDK.

Terminal
dotnet --info
cat global.json 2>/dev/null

# restore explicitly so a restore failure is not reported as a build failure
dotnet restore --verbosity normal
dotnet build --no-restore -warnaserror

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

  1. Target the host web project explicitly in dotnet publish.
  2. Use publish (not a raw file copy) so the static web assets target runs.
  3. Verify _framework scripts exist in the output.
Terminal
dotnet publish ./src/WebApp/WebApp.csproj -c Release -o ./publish
test -f ./publish/wwwroot/_framework/blazor.web.js

Do not copy bin output as the deploy artifact

Use the publish output as the artifact so the assembled _framework scripts are included.

.github/workflows/ci.yml
- uses: actions/upload-artifact@v4
  with:
    path: ./publish

How to prevent it

  • Always deploy dotnet publish output, not raw bin/.
  • Publish the correct host project in a multi-project solution.
  • Add a check that framework scripts exist before deploy.

Frequently asked questions

What causes Blazor server "blazor.web.js / blazor.server.js not found" at build in CI?
There are 2 common causes: build skipped the static web assets target and publishing the wrong project in the solution. Calling a low-level compile path or copying bin/ directly bypasses the static web assets target that emits the framework scripts.
How do I fix Blazor server "blazor.web.js / blazor.server.js not found" at build in CI?
There are 2 fixes depending on which cause you have: publish the web project so static assets build and do not copy bin output as the deploy artifact. Work through them in order, since the first is the most common.
What does Blazor server "blazor.web.js / blazor.server.js not found" at build in CI actually mean?
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.
How do I stop Blazor server "blazor.web.js / blazor.server.js not found" at build in CI happening again?
Always deploy dotnet publish output, not raw bin/. The prevention section lists 3 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card