Skip to content

MSB4006 Circular dependency error #12144

@surayya-MS

Description

@surayya-MS

Issue Description

Recently I came across circular dependency error that should not be thrown.
SimpleMultiProcTest.zip
here is a sample of 5 projects dependencies:

graph TD
    ProjectA --> ProjectB
    ProjectA --> ProjectC
    ProjectC --> ProjectD
    ProjectC --> ProjectE
Loading

When trying to build ProjectA there is sometimes MSB4006 error

Steps to Reproduce

  1. try to build ProjectA.csproj a few times until you see the error
  2. error:
dotnet build ProjectA.csproj               
Restore complete (0,3s)
  ProjectE failed with 1 error(s) (0,1s)
    /usr/local/share/dotnet/sdk/9.0.301/Microsoft.Common.CurrentVersion.targets(2138,5): error MSB4006: There is a circular dependency in the target dependency graph involving target "ResolveProjectReferences".
  ProjectD failed with 1 error(s) (0,1s)
    /usr/local/share/dotnet/sdk/9.0.301/Microsoft.Common.CurrentVersion.targets(2138,5): error MSB4006: There is a circular dependency in the target dependency graph involving target "ResolveProjectReferences".

Build failed with 2 error(s) in 0,9s

Expected Behavior

there shouldn't be any circular dependency error

Actual Behavior

MSB4006 is thrown sometimes

Analysis

No response

Versions & Configurations

17.14.5.21107

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority:1Work that is critical for the release, but we could probably ship withouttriaged

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions