How to use MSBuild to build multiple platforms

拈花ヽ惹草 提交于 2020-08-09 13:40:31

问题


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

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.

When my .appxupload package is creates it fails Windows Certification tests because my libraries are built in debug.

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?

I have tried platform="x86|x64|ARM" but it returned an error


回答1:


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>


来源:https://stackoverflow.com/questions/44434713/how-to-use-msbuild-to-build-multiple-platforms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!