Skip to content

MSBuild task restore target sometimes fails if multiple projects share a project reference #3400

Open
@appel1

Description

@appel1

As part of our build script for CI we do something like this to prepare our projects, about 1500 csproj projects using the 2017 format. They all share a project reference to a common project.

<ItemGroup>
  <TargetProjects Include="src\**\*.csproj"/>
</ItemGroup>
<MSBuild Projects="@(TargetProjects)" Targets="Restore" BuildInParallel="True"/>

When we do this we sometimes, like every other build or so, one or more of the following errors.

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets(121,5): error : The process cannot access the file 'CommonProject\obj\CommonProject.csproj.nuget.dgspec.json' because it is being used by another process. [src\proj1\proj1.csproj]

A workaround is to set BuildInParallel to False but that reduces performance quite a bit.

Is BuildInParallel not supported or is this some other kind of configuration error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions