Search code examples
visual-studio-2010visual-c++projects-and-solutions

VC++ 2010 - Adding configuration to a single project in a solution fails to build


I have the following situation:

I have a solution with ~20 C++ projects. Most are static libs, a few are DLL's and some executables. This solution has two configurations - Debug and Release, and two platforms - Win32 and x64. All has been working great for a long time.

Now I wanted to have two different behaviors for a specific static library (lib_core) - X and Y. So I added a few #ifdef's in this library code with a macro USE_X. I created a new solution configuration "Release_X" based on "Release", and renamed "Release" to "Release_Y".

I then did the same for the projects configuration of lib_core, assigned the relevant project configurations to the same solution configurations, and added the macro USE_X to Release_X project configuration.

All other projects (some of them are not even mine, so I can't change them anyway) remain with Release and Debug configurations.

Now when I tried building the project (and clean/rebuild, just in case) - lib_core fails to build with:

2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(283,5): 
error MSB8013: This project doesn't contain the Configuration and Platform combination of Release|Win32.

What is the problem here?

How can I make this work?


Solution

  • Apparently all I needed to do was to unload the project and reload it, and everything started working fine. I guess closing and reopening VS would have worked the same way.

    When I changed the MSBuild output to diagnostics mode, I saw that the configuration of the project was defined as "Release". After unloading and reloading it worked out.