Build Error 'Process cannot access the file blazor.boot.json because it is being used by another process
Hi
When trying to build a Blazor Web App in .NET 9 in TC I get the issue:
Unsure how to solve and there is not much on it.

Please sign in to leave a comment.
The error message, "The process cannot access the file 'blazor.boot.json' because it is being used by another process," indicates that multiple processes may be accessing or locking this file.
Steps to Resolve
1. Clean the Build Output Directory
Ensure the build directory is clean before starting the build (https://www.jetbrains.com/help/teamcity/clean-checkout.html).
2. Check for Background Processes
Verify that no other build agents or processes are accessing the file. Use Task Manager (on Windows) or ps (on Linux/macOS) to ensure no lingering dotnet processes are running.
3. Identify the Process Locking the File
If the issue persists, locate the process that is locking the file:
On Windows, use Sysinternals Process Explorer (https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer).
- Search for blazor.boot.json to find the locking process.
- Terminate or stop the offending process.
After applying the above changes, try triggering the build again. If the issue persists, please provide the following files for further investigation:
- teamcity-agent.log
- The full build log file
You can upload these files via https://uploads.jetbrains.com/. Once uploaded, share the exact upload ID with us for further analysis.
Best Regards,
Tom
Hi
The build failed again but now on a different process:
C:\TeamCity\buildAgent\temp\buildTmp\.nuget\packages\microsoft.net.sdk.webassembly.pack\9.0.1\build\Microsoft.NET.Sdk.WebAssembly.Browser.targets(267,5): error : Failed to convert 'C:\TeamCity\buildAgent\temp\buildTmp\.nuget\packages\microsoft.aspnetcore.components.webassembly\9.0.1\lib\net9.0\Microsoft.AspNetCore.Components.WebAssembly.dll' to webcil: The process cannot access the file 'C:\TeamCity\buildAgent\work\c0fd79306bc53374\F4L-ProjectY.Client\obj\Release\net9.0\tmp-webcil\Microsoft.AspNetCore.Components.WebAssembly.wasm' because it is being used by another process.
I have noticed the following in the log: “Unable to use package assets cache due to I/O error. This can occur when the same project is built more than once in parallel. Performance may be degraded, but the build result will not be impacted.”
Is it possible to somehow stop the build in parallel?
Upload ID for logs: 2025_01_22_umMiLj4bkjRXdfUEdsQfRa
Hi Zack,
Have you tried to use tools like Process Explorer or Resource Monitor to determine which process is locking Microsoft.AspNetCore.Components.WebAssembly.wasm? This will help pinpoint the source of the conflict. Ensure no external processes (e.g., antivirus) are interfering with build files. Add the TeamCity work directory to the exclusion list of such tools.
If you want to ensure only one build runs at a time in TeamCity:
- Navigate to Build Configuration Settings > General Settings.
- Set Total maximum builds in the configuration to 1.
Refer to the documentation for details.
By the way, the log indicates skipped optimizations due to missing tools. Install the necessary workload on the build machine:
Best Regards,
Tom
Hi
wasm-tools has now been installed - thanks for that.
Even when setting the Total maximum builds in the configuration to 1 the same issue still persists:
F4L-ProjectY.Logic -> C:\TeamCity\buildAgent\work\c0fd79306bc53374\F4L-ProjectY.Logic\bin\Release\net9.0\F4L-ProjectY.Logic.dll
15:10:51 CSC : error CS2012: Cannot open 'C:\TeamCity\buildAgent\work\c0fd79306bc53374\F4L-ProjectY.Components\obj\Release\net9.0\F4L-ProjectY.Components.dll' for writing -- 'The process cannot access the file 'C:\TeamCity\buildAgent\work\c0fd79306bc53374\F4L-ProjectY.Components\obj\Release\net9.0\F4L-ProjectY.Components.dll' because it is being used by another process.'
15:10:50 F4L-ProjectY.Logic -> C:\TeamCity\buildAgent\work\c0fd79306bc53374\F4L-ProjectY.Logic\bin\Release\net9.0\publish\
15:10:50 F4L-ProjectY.Logic -> C:\TeamCity\buildAgent\work\c0fd79306bc53374\F4L-ProjectY.Logic\bin\Release\net9.0\F4L-ProjectY.Logic.dll
15:10:51 F4L-ProjectY.Components -> C:\TeamCity\buildAgent\work\c0fd79306bc53374\F4L-ProjectY.Components\bin\Release\net9.0\F4L-ProjectY.Components.dll
15:10:51 F4L-ProjectY.Components -> C:\TeamCity\buildAgent\work\c0fd79306bc53374\F4L-ProjectY.Components\bin\Release\net9.0\publish\
15:10:51
15:10:51 Build FAILED.
15:10:51
15:10:51 0 Warning(s)
15:10:51 1 Error(s)
I have noticed the following in Task Manager, but this just looks like what would happen when dotnet is working when the build is triggered?
After speaking to our IT Support it has been confirmed that our Team City work directory is excluded.
We have other projects that use Blazor Server and build fine, so this just seems to be a problem with Blazor Web Apps using both Server and Client (Web Assembly)?
Hi,
The issue has now been resolved by installing the wasm-tools and then restarting the server/team city (which we did not do at first)
Still unsure of what was causing the issue and why installing the above (which was optional) solved it.