Blazor "Could not find a part of the path ... _framework" in CI
By Daniel Zoghalchali·Latchkey
Blazor WebAssembly publish writes the runtime and assemblies into a wwwroot/_framework folder. When a deploy or zip step looks there and the publish wrote elsewhere (or failed earlier), you get "Could not find a part of the path ..._framework".
What this error means
A step after publish (copy, zip, or upload) fails with "Could not find a part of the path '.../wwwroot/_framework'" because the expected publish output is not where the step expects.
dotnet
System.IO.DirectoryNotFoundException: Could not find a part of the path
'/home/runner/work/app/app/bin/Release/net8.0/publish/wwwroot/_framework'.
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
The publish output path differs from the deploy path
The deploy step hardcodes a path that does not match the actual --output of dotnet publish, so _framework is not there.
Publish failed or was skipped earlier
An earlier non-fatal warning let the job continue, but publish never produced _framework, so the next step cannot find it.
How to fix it
Publish to an explicit output and reuse it
Publish with an explicit --output directory.
Reference that same directory in the deploy or zip step.
Confirm wwwroot/_framework exists before continuing.
Add a guard so a missing _framework folder fails the step with a clear message instead of a path error later.
Terminal
ls -la ./publish/wwwroot/_framework || exit 1
How to prevent it
Use one --output path for publish and downstream steps.
Verify the publish output exists before deploy or upload.
Do not let earlier warnings be treated as a successful publish.
Frequently asked questions
What causes Blazor "Could not find a part of the path ... _framework" in CI?
There are 2 common causes: the publish output path differs from the deploy path and publish failed or was skipped earlier. The deploy step hardcodes a path that does not match the actual --output of dotnet publish, so _framework is not there.
How do I fix Blazor "Could not find a part of the path ... _framework" in CI?
There are 2 fixes depending on which cause you have: publish to an explicit output and reuse it and fail fast if publish did not produce output. Work through them in order, since the first is the most common.
What does Blazor "Could not find a part of the path ... _framework" in CI actually mean?
A step after publish (copy, zip, or upload) fails with "Could not find a part of the path '.../wwwroot/_framework'" because the expected publish output is not where the step expects.
How do I stop Blazor "Could not find a part of the path ... _framework" in CI happening again?
Use one --output path for publish and downstream steps. The prevention section lists 3 changes that keep it from recurring.