dotnet / dotnet/msbuild

Random build failures when using parallel build

Open
#4,887 5 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

### Description

When using parallel build with msbuild one can get random build failures due to files being locked. This happens even with nodeReuse:false. This happens both locally and on our Azure Pipeline build. At some point I suspected the virus scanner but the error even happens when the virus scanner is turned off. The only way to prevent this seems to be turning parallel build off (remove the maxcpucount:4).

### Steps to reproduce

This is the command we use to build our solution:
```
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64\msbuild.exe" "D:\a\1\s\ANWB Reizen.sln" /maxcpucount:4 /nodeReuse:False /p:Configuration=Release /p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:SkipExtraFilesOnServer=True /p:WebPublishMethod=FileSystem /p:publishUrl=D:\a\1\s\buildoutput\cmcd /target:Build /verbosity:Quiet
```
The error we then sometimes get (can happen with any file it seems, not just Lucene.Net.pdb):
```
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\Web\Deploy\Microsoft.Web.Publishing.Deploy.FileSystem.targets(96,5): error :
Copying file obj\Release\Package\PackageTmp\bin\Lucene.Net.pdb to D:\a\1\s\buildoutput\cmcd\bin\Lucene.Net.pdb failed. The process cannot access the file 'D:\a\1\s\buildoutput\cmcd\bin\Lucene.Net.pdb' because it is being used by another process.
[D:\a\1\s\src\Foundation\Macaw\Logging\code\Foundation.Macaw.Logging.csproj]
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.