开发者

"OutputPath property is not set" error occurs only when calling MSBuild in CCNET

I've made an MSBuild project that simply does an msbuild task with our solution file as parameter. I've defined a BeforeBuild target where I set some properties, and a Build target that executes the msbuild task.

I've confirmed that no errors occured when building the msbuild script in the command line console. However, when I use it in the msbuild task in my CCNET project, I keep getting the following error:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (483,9): error: The OutputPath property is not set for project 'MyProject.msbuild'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='AnyCPU'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project.

I checked the build log and it seems that the error occurs during _CheckForInvalidConfigurationAndPlatform. It wasn't even able to continue to my Build task! Since the script is only intended to build the solution under Debug/Release and AnyCPU as platform, I tried to add the following lines to my msbuild project:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' ==  'Debug|AnyCPU' ">
  <OutputPath>.\bin\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' ==  'Release|AnyCPU' ">
  <OutputPath>.\bin\Release\</OutputPath>
</PropertyGroup>

I could still build the project without errors in the command line, but CCNET is returning the same error mentioned above.

I don't understand why CCNET keeps getting the erro开发者_Go百科r, and I don't know what else to try.

Please help.


I found I had a similar situation (but using TeamCity as my CI environment). In my particular case, the project was a Command Line application. To solve it, I had to manually edit my project file.

Find these lines:

<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>

Change the second line to:

<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>

The find the other platform-specific lines in the project file and change them. Example:

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">

becomes:

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

My suspicion is our build servers are 64-bit and the Console Application project type in Studio won't let you make the project fit an AnyCPU platform...

After these changes, TeamCity had no problem with my build script.


The answer from David helped me. But later I found the actual source of the issue for my computer. The PLATFORM environment variable is added on HP machines and does impact a number of different scenarios with Visual Studio.

Go into Environment Variables-> System Variables and remove the "PLATFORM" from the list.

See additional details here: http://blogs.msdn.com/b/jnak/archive/2010/03/24/outputpath-property-is-not-set-for-project-error-when-building-a-windows-azure-cloud-service-in-vs-2010.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜