The OutputPath property is not set for this project.
-
Friday, January 19, 2007 4:40 PM
Hi,
I get this error when I run a Database Unit Test.
Target _CheckForInvalidConfigurationAndPlatform:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(481,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' Platform=''
Done building target "_CheckForInvalidConfigurationAndPlatform" in project "NorthwindDemo.dbproj" -- FAILED.
Done building project "NorthwindDemo.dbproj" -- FAILED.
If I build the failing project alone, the build succeeds.
Looking at the NorthwindDemo.dbproj file, there is two PropertyGroup section. The first one is for this configuration:
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Default</Configuration>and the second is like this:
<PropertyGroup Condition=" '$(Configuration)' == 'Default' ">
In the second PropertyGroup, there was already an outputpath specified, but none in the first one. I added the following code to the first PropertyGroup:
<OutputPath>.\sql\</OutputPath>
and it fixed the problem. I can now run my test ok.
In the project properties build window, I only have one possible Configuration and Platform to select from, and for those I have a Build Output Path set to .\sql\.
There must be another way of fixing the problem I had... or is this a bug?
Thanks.
Joe
Edit:
BTW, I had this problem when following the Introductory Walkthroughs. And again in another solution.
Answers
-
Monday, January 29, 2007 10:27 PM
Hi Joe,
The Database project by default just comes with one configuration – Default. When a C#/VB project is added to a solution containing a Database project, Debug and Release configurations are also added to the solution. With these two additional configurations, it is possible to get into a state where the Database project will fail to build because the configuration (Debug or Release) is not defined for the Database project.
MSBuild uses the OutputPath variable to determine if a configuration is actually valid for the project. Although adding the OutputPath property to the configuration independent property group seemed to fix the problem it actually is hiding the issue because the database project will be using all defaults when building with Debug or Release. To fix the issue, you should be able to add a Debug (and/or) Release configuration to the Database project through the Solution configuration dialog. Or, to add it directly to the project file - something like this:
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<SetVariables>
<OutputPath>.\Debug\</OutputPath>
</PropertyGroup>
This will ensure that the appropriate configuration is created for you in the .dbproj file.

