Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

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

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}
EndProjectSection
EndProject

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}"
EndProject

Now you should be able to use MSBuild successfully.
Exit mobile version