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?
Create a project configurationSelect a project in the Project column. In the Configuration drop-down list for that project, choose New. The New Project Configuration dialog box opens. In the Name box, enter a name for the new configuration.
Right-click on the project node and select Options. You can also double-click on the project node to bring up the Project Options dialog. Select Add to create a new configuration. You can also copy any of the existing configurations.
On the menu bar, choose Build > Configuration Manager. In the Project contexts table, locate the project you want to exclude from the build. In the Build column for the project, clear the check box. Choose the Close button, and then rebuild the solution.
Applies to: Visual Studio Visual Studio for Mac Visual Studio Code. You need build configurations when you need to build your projects with different settings. For example, Debug and Release are build configurations, and different compiler options are used accordingly when building them.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With