Summary
On windows-latest, dotnet build intermittently fails with file locking errors in src\Xml2Doc.Core\obj\Release\{tfm}\...GeneratedMSBuildEditorConfig.editorconfig and/or CS2012 failing to write obj\Release\{tfm}\Xml2Doc.Core.dll.
Environment
- Runner:
windows-latest
- Build command:
dotnet build ... --configuration Release --no-restore
- Observed SDK:
10.0.100 (from build output)
Steps to Reproduce
- Run Merge Test Workflow on a PR targeting
main.
dotnet clean
dotnet restore
dotnet build ... --configuration Release --no-restore
Expected
Build completes successfully.
Actual
Build fails with errors like:
Microsoft.Managed.Core.targets(...): The process cannot access ...GeneratedMSBuildEditorConfig.editorconfig because it is being used by another process.
CSC : error CS2012: Cannot open ...obj\Release\net9.0\Xml2Doc.Core.dll for writing -- The process cannot access the file because it is being used by another process. ([Microsoft Learn][2])
Notes / suspected cause
This appears to be a Windows file-handle contention issue involving Roslyn/MSBuild intermediates and/or compiler/build servers, exacerbated by parallel build behavior.
Proposed fix
- Disable/flush build servers in CI (
dotnet build-server shutdown, --disable-build-servers). ([Microsoft Learn][3])
- Reduce parallelism for the CI build (
-m:1, MSBUILDDISABLENODEREUSE=1). ([GitHub][4])
- Optionally disable shared compilation in CI (
UseSharedCompilation=false) since it defaults to true. ([GitHub][1])
Acceptance criteria
- CI build and tests pass reliably across repeated runs on
windows-latest.
- No intermittent “file used by another process” failures.
Summary
On
windows-latest,dotnet buildintermittently fails with file locking errors insrc\Xml2Doc.Core\obj\Release\{tfm}\...GeneratedMSBuildEditorConfig.editorconfigand/orCS2012failing to writeobj\Release\{tfm}\Xml2Doc.Core.dll.Environment
windows-latestdotnet build ... --configuration Release --no-restore10.0.100(from build output)Steps to Reproduce
main.dotnet cleandotnet restoredotnet build ... --configuration Release --no-restoreExpected
Build completes successfully.
Actual
Build fails with errors like:
Microsoft.Managed.Core.targets(...): The process cannot access ...GeneratedMSBuildEditorConfig.editorconfig because it is being used by another process.CSC : error CS2012: Cannot open ...obj\Release\net9.0\Xml2Doc.Core.dll for writing -- The process cannot access the file because it is being used by another process.([Microsoft Learn][2])Notes / suspected cause
This appears to be a Windows file-handle contention issue involving Roslyn/MSBuild intermediates and/or compiler/build servers, exacerbated by parallel build behavior.
Proposed fix
dotnet build-server shutdown,--disable-build-servers). ([Microsoft Learn][3])-m:1,MSBUILDDISABLENODEREUSE=1). ([GitHub][4])UseSharedCompilation=false) since it defaults to true. ([GitHub][1])Acceptance criteria
windows-latest.