Search code examples
visual-studiovisual-studio-2012visual-c++-2012

Visual Studio 2012 C++ solution cannot be built after project import


I use Visual Studio 2012 Premium (Version 11.0.61219.00 Update 5). There is a C++ solution with some projects. Everything can be built without errors. Then I import a new (but already existing) project into this solution (via right-click -> Add -> Existing Project...). If I now try to build this project or any other of the previous projects, an error message appears: "Cannot perform requested action because a build is already in project" (which is not true, there is no build running).

enter image description here

If I try to rebuild the complete solution, another message is shown: "The operation could not be completed. Wrong parameter."

enter image description here

At the same time, there are no errors or warnings in the output view at all. Rather a build summary is given, which looks OK.

Build Summary
-------------

Total build time: 00:12.379

========== Rebuild All: 0 succeeded or up-to-date, 0 failed, 12 skipped, Completed at 30.09.2015 17:15:58 ==========

enter image description here

What could be wrong here? The project seems to be intact, I can open and view the properties, nothing suspicious. In fact, I imported the other 11 projects in the same way and from the same origin. Where can I get some Visual Studio log files or turn on any extended diagnostics which could point me to the right direction? Help me, I'm stuck!


Solution

  • We now figured out what was the reason for this behavior. The "guilty" project contained references to other projects in the solution. Other projects did, too (and worked); but the project GUID of this particular reference was not consistent with the actual GUID of the referenced project. If we view the contents of *.vcxproj file in a text editor, we find this GUID as nested <Project> element within <ProjectReference> element (s. screenshot).

    enter image description here

    As I mentioned in the comments, all projects were generated from an external specification written in a domain-specific language. There was a subtle bug in the generator mechanism, which under certain conditions led to this wrong GUID reference.

    What amazes me, however, is that Visual Studio has not shown any easy-to-understand error message for such an obvious issue! If the path to the reference project is incorrect, the Studio points this out by a bold excamation mark (s. screenshot). Why not do the same in case of an invalid GUID? It took us several hours to diagnose this trifle.

    enter image description here