本文介绍了MSbuild任务失败,因为"Any CPU"被拒绝.解决方案是无序构建的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两种在Teambuild中构建的解决方案,一种是应用程序本身,另一种是WiX安装程序.我想使用任何CPU"构建配置来构建应用程序,并使用"x86"构建安装程序.我已经在项目文件中首先列出了任何CPU"解决方案,但是Teambuild始终会首先构建"x86"解决方案.

I have two solutions to build in Teambuild, one is the application itself, the other one is the WiX installer. I want to build the application using "Any CPU" build configuration and the installer using "x86". I've listed the "Any CPU" solution first in my project file, but Teambuild always builds the "x86" solution first.

我正在设置BuildSolutionsInParallel = false,但是它仍然按照相反的顺序构建解决方案.如果我将第一个解决方案更改为混合平台",则可以正常工作.如何获得按项目文件中列出的顺序构建的解决方案?

I'm setting BuildSolutionsInParallel = false, but it still builds the solutions in the reverse listed order. If I change the first solution to "Mixed Platform", it works fine. How can I get the solutions to build in the order listed in the project file?

<Project ...>
<PropertyGroup>
  <!-- We want to build the install solution after the build solution -->
  <BuildSolutionsInParallel>false</BuildSolutionsInParallel>
</PropertyGroup>

<ItemGroup>
  <SolutionToBuild Include="$(BuildProjectFolderPath)/Pricer/Pricer.sln">
    <Targets></Targets>
    <Properties></Properties>
  </SolutionToBuild>
  <SolutionToBuild Include="$(BuildProjectFolderPath)/Pricer/Pricer.Install/Pricer.Install.sln">
    <Targets></Targets>
    <Properties></Properties>
  </SolutionToBuild>
</ItemGroup>

  <ItemGroup>
    <ConfigurationToBuild Include="Release|Any CPU">
      <FlavorToBuild>Release</FlavorToBuild>
      <PlatformToBuild>Any CPU</PlatformToBuild>
    </ConfigurationToBuild>
    <ConfigurationToBuild Include="Release|x86">
      <FlavorToBuild>Release</FlavorToBuild>
      <PlatformToBuild>x86</PlatformToBuild>
    </ConfigurationToBuild>
  </ItemGroup>
</Project>

推荐答案

可以为属于同一解决方案的项目设置项目构建顺序.在这种情况下,出于不相关的原因,项目需要属于2个不同的解决方案.

Project Build Order may be set for projects belonging to the same solution. In this case, for unrelated reasons the projects need to belong to 2 different solutions.

我在这里发现这样,混合平台"解决方案中的C#项目将以任何CPU"的形式生成,因此解决方案是始终在Teambuild项目文件中使用混合平台".

I've discovered here that a C# project in a "Mixed Platforms" solution will build as "Any CPU", so the solution is to always use "Mixed Platforms" in the Teambuild project file.

这篇关于MSbuild任务失败,因为"Any CPU"被拒绝.解决方案是无序构建的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 22:48