Question

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?

Was it helpful?

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.

OTHER TIPS

Right click on your project and choose "Properties", then click on the "Configuration Manager" button.

You should be able to specify which "Configuration" for the lib_core project should be used for each solution configuration and platform.

I successfully used that for making VS build one project in Release mode while building the solution for Debug.

I have the same error due to the difference between "ProjectConfiguration Include" and "Configuration" in the project settings file. Try to check ".vcxproj" file with Visual Studio project settings.

The error text:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(61,5): error MSB8013: This project doesn't contain the Configuration and Platform combination of Debug static library|Win32.

Example of file project settings with errors:

<ProjectConfiguration Include="Debug static library test|Win32">
  <Configuration>Debug static library</Configuration>
  <Platform>Win32</Platform>
</ProjectConfiguration>

Example of file with project settings without errors:

<ProjectConfiguration Include="Debug static library|Win32">
  <Configuration>Debug static library</Configuration>
  <Platform>Win32</Platform>
</ProjectConfiguration>

If the project has any references under Common Properties-> Framework and References, please remove it and add it again. This has worked for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top