Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!

How to Fix MSBuild Error MSB4006

Author: Craig Stuntz

You may encounter an error which looks like this:

MSB4006: There is a circular dependency in the target dependency graph involving target “ResolveProjectReferences” [MyProjectName\MyProjectName.csproj]

…when running MSBuild from the command line.

This error happens when:

  1. You run MSBuild on a machine with .NET 4.5 installed and

  • You build a project referencing a solution where the SLN file contains dependencies in the SLN.
These dependencies are the dependencies you’ll get if you right click a project in Solution Explorer, choose Project Dependencies, and start checking projects. This is usually unnecessary as project dependencies can be inferred from the References.

The fix is to open the SLN file in your favorite text editor, and search for sections like this:

Project("{AAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyProjectName", "MyProjectName\MyProjectName.csproj", "{B10E1FCF-DFBA-44A8-830F-6F3B54DFA7CB}"
ProjectSection(ProjectDependencies) = postProject
{B9E9F8CE-A607-4A6C-97F7-2BD439122F89} = {B9E9F8CE-A607-4A6C-97F7-2BD439122F89}

Just delete the entire section, so your Project node looks like this:

Project("{AAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyProjectName", "MyProjectName\MyProjectName.csproj", "{B10E1FCF-DFBA-44A8-830F-6F3B54DFA7CB}"

Now you should be able to use MSBuild successfully.

Coding Boot Camp

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Related posts

Parallel Compiling 300 Native Windows Apps In 45 Seconds With Delphi On An AMD Ryzen 9 5950x


What's New in the GetIt Package Manager - June 2020


RAD Studio 10.4 Now Available, Learn More


Open for Business with 10.4! - May 2020 GM Update

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.