MSBuild 任务配置属性 [英] MSBuild task configuration property

查看:16
本文介绍了MSBuild 任务配置属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有三个 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 脚本明确说明要构建的配置(调试)时,第一个项目仍然是作为 Release 构建的.

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)CoreSolution2.sln"/>
        <ProjectToBuild Include="$(SolutionsPath)UISolution3.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)CoreSolution2.sln">
            <Properties>Configuration=Debug</Properties>
        </ProjectToBuild>

        <ProjectToBuild Include="$(SolutionsPath)UISolution3.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.

我该如何解决这个问题?

How can I fix this problem?

推荐答案

好的,我找到了问题.与 MSBuild 无关,而是正在构建的解决方案.发帖拯救别人的心痛.

OK I have found the issue. Nothing related to MSBuild, but instead the solution being built. Posting to save someone else the heartache.

无论出于何种原因,在解决方案中配置了调试配置,如下所示:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆