如何使用MSBuild构建多个平台 [英] How to use MSBuild to build multiple platforms
问题描述
我正在将Visual Studio在线构建与MSBuild任务一起使用.我目前有以下MSBuild参数可用于我的任务:
I am using Visual Studio online build with an MSBuild task. I currently have the following MSBuild Arguments fed to my task:
/p:Configuration=Release;AppxBundle=Always;AppxBundlePlatforms="x86|x64|ARM";AppxPackageDir="$(Build.BinariesDirectory)\AppxPackages\\";UapAppxPackageBuildMode=StoreUpload
这将在 x86
, x64
和 ARM
中创建我的应用程序.它在 x86
中创建库的发行版,但在 x64
和 ARM
中创建我的库的Debug版本.
This creates my application in x86
, x64
and ARM
. It creates Release version of the libraries in x86
BUT creates Debug version of my libraries in x64
and ARM
.
创建我的 .appxupload
软件包时,由于我的库是在调试中构建的,因此Windows认证测试失败.
When my .appxupload
package is creates it fails Windows Certification tests because my libraries are built in debug.
如何为所有3种配置构建MSBuild.我的猜测是因为我没有提供/platform
配置.如何为3个平台提供此配置?
How can I make MSBuild build for all 3 configurations. My guess is because I haven't provided a /platform
configuration. How do I provide this configuration for 3 platforms?
我尝试了 platform ="x86 | x64 | ARM"
,但返回了错误
I have tried platform="x86|x64|ARM"
but it returned an error
推荐答案
对于标准项目文件,无法在单个命令中执行此操作.使用多个命令为所需的每个平台/配置组合构建项目,或使用为您执行相同操作的主"构建文件,例如:
For a standard project file there's no way to do this in a single command. Either use multiple commands to build the project for each platform/configuration combination needed, or use a 'master' build file which does the same for you, something like:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="FullRebuild">
<Target>
<ItemGroup>
<Configurations Include="Debug;Release"/>
<Platforms Include="x86;x64;ARM"/>
<ConfigAndPlatform Include="@(Configurations)">
<Platform>%(Platforms.Identity)</Platform>
</ConfigAndPlatform>
</ItemGroup>
<MSBuild Projects="myproject.sln" Targets="Build"
Properties="Configuration=%(ConfigAndPlatform.Identity);Platform=%(ConfigAndPlatform.Platform)"/>
</Target>
</Project>
这篇关于如何使用MSBuild构建多个平台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!