Blazor "Could not find a part of the path ... _framework" in CI
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.
System.IO.DirectoryNotFoundException: Could not find a part of the path
'/home/runner/work/app/app/bin/Release/net8.0/publish/wwwroot/_framework'.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
--outputdirectory. - Reference that same directory in the deploy or zip step.
- Confirm
wwwroot/_frameworkexists before continuing.
- run: dotnet publish -c Release -o ./publish
- run: test -d ./publish/wwwroot/_frameworkFail fast if publish did not produce output
Add a guard so a missing _framework folder fails the step with a clear message instead of a path error later.
ls -la ./publish/wwwroot/_framework || exit 1How to prevent it
- Use one
--outputpath 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.