问题描述
有谁知道如何使用 MSbuild 工具通过桌面桥(桌面扩展)包构建 (.appxupload/.appxbundle) 自动化 UWP?
我在 以下博客上进行了设置.
Does anyone know how to automate UWP with Desktop Bridge (Desktop Extension) package build (.appxupload/.appxbundle) by using MSbuild tool?
I've got the setup like on the following blog.
对于简单的 UWP 应用(没有桌面扩展),我可以使用以下命令:
For the simple UWP app (without Desktop Extension) I’m able to this with the following command:
msbuild UWP.sln /p:Configuration=Release;AppxBundle=Always;AppxBundlePlatforms="x86|x64|ARM";UapAppxPackageBuildMode=StoreUpload
然而,当我在 Package.waapproj
上尝试时,我遇到了一堆错误.例如,虽然 Package 项目有一个证书,但 UWP 项目也需要一个(为什么?),当我解决这个问题时,msbuild 需要一个来自 bin/Debug 的 build.appxrecipe,尽管我正在构建 Release 等.
However, when I try it on Package.wapproj
I’ve got a bunch of errors.For instance, although Package project has a certificate, UWP project also demands one (why?), when I workaround that problem, msbuild demands a build.appxrecipe from bin/Debug, although I’m building Release etc.
推荐答案
这里有同样的经历,但我设法通过分别构建 x86 和 x64 项目绕过找不到配方文件"错误,然后运行 msbuild 命令打包两者.这是我的笔记:
Same experience here, but I manage to bypass the "Could not find a recipe file" error by build x86 and x64 project separately, and then run the msbuild command to package both. Here are my notes:
因为我的解决方案有一个桌面扩展项目、几个 c# 项目和几个测试项目,所以我必须指定
或
从不
在项目文件中,一一.
Because my solution has one Desktop Extension project, several c# projects, and a few test projects, I have to specify
<AppxBundle>Always</AppxBundle>
or<AppxBundle>Never</AppxBundle>
in the project files, one by one.
同时清洁 x86 和 x64.
Clean both x86 and x64.
首先构建 x86.msbuild .MyApp.sln/p:Configuration=Release/p:Platform=x86
构建 x64.msbuild .MyApp.sln/p:Configuration=Release/p:Platform=x64
在命令行中运行这个 msbuild 命令:
Run this msbuild command in command line:
msbuild .MyApp.sln/p:Configuration=Debug/p:AppxBundlePlatforms="x86|x64"/p:AppxPackageDir="C:DevelopMyAppAppPackages"/p:UapAppxPackageBuildMode=StoreUpload
注意我必须在命令中添加AppxPackageDir,否则它只会捆绑x64,而不是x86.我还不知道为什么.
Note that I have to add AppxPackageDir in the command, otherwise it will only bundle x64, not x86. I don't know why yet.
然后您将看到在 AppxPackageDir 下创建了所有包文件夹,包括 x64 和 x86.将在文件夹外创建一个上传包.
Then you will see all the bundle folders are created under the AppxPackageDir, both x64 and x86. The one single upload bundle will be created outside of the folders.
构建发布版本需要很长时间,但它可以在命令行中运行.自动化,我们开始了!
It takes forever to build the release builds, but it works in command line. Automation, here we go!
这篇关于UWP 与桌面桥包构建自动化与 MSbuild的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!