0

我向我的 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]

有谁知道我如何在默认配置块之后添加新配置?一旦我将配置块与其他配置一起向下移动,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 --> ...

4

0 回答 0