Error while removing project dependency in VS2010

Aneesh Narayanan picture Aneesh Narayanan · Oct 10, 2012 · Viewed 26.8k times · Source

I have a large solution with number of projects. Some the projects depend on others (never a circular dependency though).

When I tried to remove a dependency of a project, I am getting an error message like "The dependency was added by the project system and cannot be removed". What is the cause for this error? How I can solve this?

Answer

malenkiy_scot picture malenkiy_scot · Nov 21, 2012

I sometimes get this problem when I try to manually edit projects/solutions generated by our CMake system. I solve it manually:

  • Open the dependent .vcproj file in your favorite text editor.
  • Find <ProjectReference> tag corresponding to the dependency you want to remove (the include attribute of the tag will contain the name of the dependency project).
  • Remove the whole <ProjectReference> element (i.e. starting with <ProjectReference> and ending with </ProjectReference> inclusive). Save the file.
  • Reload the solution.