我在我的MVC应用程序中添加了一个新配置。 Visual Studio 2012将配置块添加到.csproj的顶部。然后当我尝试通过msbuild构建项目时:
msbuild WebApp.csproj /t:Clean;Build;_WPPCopyWebApplication /p:Configuration=QA;WebProjectOutputDir=c:\builds\webapp\qa
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(609,5): error : The OutputPath property is not set for project 'WebApp.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='QA' 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. [c:\code\WebApp.csproj]
有谁知道如何在默认配置块中添加新的配置 AFTER ?一旦我将配置块与其他配置一起移动,MSBuild就可以正常工作了。
编辑以显示Visual Studio 2012如何添加配置:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- NEW CONFIGURATIONS ARE ADDED HERE -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'QA|AnyCPU'">
</PropertyGroup>
<!-- DEFAULT PropertyGroup is here -->
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<!-- blah blah -->
</PropertyGroup>
<!-- EXISTING CONFIGURATIONS ARE DOWN HERE -->
...