dotnet / dotnet/msbuild

MSBuild version 17.4.0 getting CS2012 files in use by another process errors

Open
#8,154 12 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

DevOps on premise server with update of VS2022 to 17.4 no longer builds existing solutions that have multiple projects, including test projects. These are Windows Build Agents both running on the DevOps and on a Docker Server that is running multiple ServerCore build agents. These were all updated to latest buildtools to get 17.4 functionality.

Same solution built fine on Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET, and if I take same solution and build on Ubuntu agent, it builds with no issues using MSBuild version 17.3.2+561848881 for .NET.

It appears like the main project and test project may be building the main project at the same time in parallel. By default it is not supposed to be running parallel builds according to documentation.

```
-maxCpuCount[:n] Specifies the maximum number of concurrent processes to
build with. If the switch is not used, the default
value used is 1. If the switch is used without a value
MSBuild will use up to the number of processors on the
computer. (Short form: -m[:n])
```

Build Command:
dotnet.exe build FullPathToSolutionFile.sln --configuration Release --no-restore --self-contained false

Solution has one project and one xUnit test project in net6.0. the xUnit has a project reference to the main project.

Build error:
Error CS2012: Cannot open because it is being used by another process.

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.