I spent about a full day solving a strange error in one of my Visual Studio projects. It is a VS2010 (RC) solution that I upgraded from VS2008. The thing that started it all was my adding a new configuration to the solution via the configuration manager. I added the new configuration to enable static source code analysis available in the VS2010 RC.
It should be noted that I wanted to maintain the VS2008 projects at the same time, so what I did in order to be able to open the solution from both VS2008 and VS2010 is the following:
- Made a copy of the .sln and .vcproj files, naming them [original name]-2010.[extension]
- Edited the VS2010 .sln file via a text editor, changing the name of all project files to the newly-created VS2010 file names
- Opened the 2010 .sln file in VS2010, allowing VS to upgrade the solution and project files to VS2010 version
This worked very well, and all appeared to be running well. I could open the solution in either VS2008 (using the original solution and project files) and VS2010. Sometimes the Visual Studio versions would step over each other’s toes, so it seemed safer to have only one version open of the same solution at one time. Otherwise, everything worked perfectly.
Trying to enable static source code analysis on the VS2010 solution, I created a new configuration on the VS configuration manager, it is a configuration based on the “Debug” configuration, except this one has enabled code analysis. I made it a separate configuration because 1) It takes longer to compile with code analysis turned on; and 2) There are a ton of warnings that come up when you enable code analysis on a mature project.
What happened is that the solution stopped compiling successfully with the new configuration. I would get the error message of:
C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(539,9): error : The OutputPath property is not set for this project. Please check to make sure that you have specified a valid Configuration/Platform combination. Configuration=’Debug (Source Check)’ Platform=’x86′
There would be multiple error messages like this, for several of my projects.
I spent a lot of time trying to solve this, and finally I found a post on Microsoft Connect that led me to the right answer: because of how I created the copy of my solution to upgrade, the references between projects in my solution were still referencing the VS2008 versions of the project, not the upgraded VS2010 project files.
This meant that, while I had created the new solution configuration under VS2010, the compilation process was looking in the VS2008 project files for solving the project references. Not good.
So the solution to this was to remove the VS2008 project references, and re-add the project references within VS2010 using the VS2010 projects. this fixed the problem instantly.