我正在尝试编辑我的项目文件,以使我能够拥有一个可以同时构建多个构建配置的项目。我使用批处理方法并使用 MSBuild 任务(见下文)完成了这项工作。
如果我运行脚本,我会收到以下错误:
错误 103 未为项目“ThisMSBuildProjectFile.csproj”设置 OutputPath 属性。请检查以确保您为此项目指定了有效的配置和平台组合。配置='调试'平台='AnyCPU'。
如果我从 MSBuild 任务中添加或省略 OutputPath,我会得到这个。如果使用 VS2010 调试器逐步执行脚本并调用 MSBuild 任务 - 调试器再次进入文件,然后进入 OutputPath,所以 afaik,它应该选择那个值,不是吗?
对此的任何帮助将不胜感激 - 这让我发疯。谢谢,保罗。
ThisMSBuildProjectFile.csproj(取出多余的东西):
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<!-- Only Import normal targets if not building multiple projects -->
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition="'$(Configuration)|$(Platform)' != 'AllBuild|AnyCPU' "/>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == '' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>C:\Folder\Etc\Output\$(Configuration)\</OutputPath>
<OutDir>C:\Folder\Etc\Output\$(Configuration)\</OutDir>
<BaseOutputPath>C:\Folder\Etc\Output\$(Configuration)\</BaseOutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<!-- Common -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<Platform>AnyCPU</Platform>
<!-- Repeated properties from above here (including, of course, OutputPath) -->
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<!-- Repeated properties from above here (including, of course, OutputPath) -->
</PropertyGroup>
<ItemGroup>
<Projects Include="C:\Folder\Etc\ThisMSBuildProjectFile.csproj" />
</ItemGroup>
<!-- Call this project file again, but with a different configuration - if this was working, this would call multiple build configs -->
<Target Name="Build" Condition="'$(Configuration)|$(Platform)' == 'AllBuild|AnyCPU' ">
<Message Text="hm!"/>
<!-- Tried thiswith and without the OutputPath property - makes no difference. -->
<MSBuild Projects="@(Projects)" Properties="Configuration=Debug;OutputPath=C:\Folder\Etc\Output\" ToolsVersion="4.0" Condition="'$(Configuration)|$(Platform)' == 'AllBuild|AnyCPU' "/>
</Target>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AllBuild|AnyCPU' ">
<!-- Repeated properties from above here (including, of course, OutputPath) -->
</PropertyGroup>
<!-- Project files -->
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Blah\Blah.cs" />
</ItemGroup>