MSBuild任务配置属性 [英] MSBuild task configuration property
问题描述
我有三个Visual Studio解决方案.第一个配置为构建为 Release ,其他两个设置为构建为 Debug .
I have three Visual Studio solutions. The first is configured to build as Release, and the other two are set to build as Debug.
在运行简单的 MSBuild 脚本时,会明确说明要构建(调试)的配置,第一个项目仍是发布版本.
When running a simple MSBuild script explicitly stating the configuration to build (Debug), the first project is still built as Release.
示例脚本:
<Target Name="Build">
<ItemGroup>
<ProjectToBuild Include="$(SolutionsPath)\Solution1.sln"/>
<ProjectToBuild Include="$(SolutionsPath)\Core\Solution2.sln"/>
<ProjectToBuild Include="$(SolutionsPath)\UI\Solution3.sln"/>
</ItemGroup>
<MSBuild Projects="@(ProjectToBuild)"
Targets="Rebuild"
Properties="Configuration=Debug;Platform=Any CPU"/>
</Target>
我尝试了上述方法的变体,例如以下示例,但最终总是得到相同的结果.
I have tried variations of the above such as the following, but I always end up with the same result.
<Target Name="Build">
<ItemGroup>
<ProjectToBuild Include="$(SolutionsPath)\Solution1.sln">
<Properties>Configuration=Debug</Properties>
</ProjectToBuild>
<ProjectToBuild Include="$(SolutionsPath)\Core\Solution2.sln">
<Properties>Configuration=Debug</Properties>
</ProjectToBuild>
<ProjectToBuild Include="$(SolutionsPath)\UI\Solution3.sln">
<Properties>Configuration=Debug</Properties>
</ProjectToBuild>
</ItemGroup>
<MSBuild Projects="@(ProjectToBuild)"
Targets="Rebuild"
Properties="Platform=Any CPU"/>
</Target>
我注意到还有一个类似的问题, MSBuild任务-生成失败,因为一种解决方案是在发行版中构建而不是在调试中 ,但这特定于TFS和Teambuild.我说的是纯MSBuild,带有从头开始创建的简单项目文件.
I note there is a similar question, MSBuild task - Build fails because one solution being built in release instead of debug, but that is specific to TFS and Teambuild. I am talking pure MSBuild with a simple project file created from scratch.
如何解决此问题?
推荐答案
确定,我发现了问题.与MSBuild无关,而是与正在构建的解决方案有关.发布以挽救别人的心痛.
OK I have found the issue. Nothing related to MSBuild, but instead the solution being built. Posting to save someone else the heartache.
无论出于何种原因,都在解决方案中配置了Debug配置,如下所示:
For whatever reason the Debug configuration was configured within the solution like so:
替代文本http://www.freeimagehosting.net/uploads/cad0bdf1c0.jpg
因此,MSBuild也只执行了被告知的事情...
So MSBuild was only doing what it was told too...
这篇关于MSBuild任务配置属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!