问题
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.
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
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.
回答1:
It's a known issue. The relevant team have been investigating it. As some workarounds, the most obvious is to avoid multi-platform builds.
Please keep in mind that Centennial does not work in ARM, so makes no sense to include that platform. Also building for X86 and X64 to produce a bundle is somehow problematic.
You could try to build for only one platform X86 or X64 and set the AppxBundle=Never, finally build the solution not the wapproj.
回答2:
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:
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.Clean both x86 and x64.
Build x86 first.
msbuild .\MyApp.sln /p:Configuration=Release /p:Platform=x86
Build x64.
msbuild .\MyApp.sln /p:Configuration=Release /p:Platform=x64
Run this msbuild command in command line:
msbuild .\MyApp.sln /p:Configuration=Debug /p:AppxBundlePlatforms="x86|x64" /p:AppxPackageDir="C:\Develop\MyApp\AppPackages\" /p:UapAppxPackageBuildMode=StoreUpload
Note that I have to add AppxPackageDir in the command, otherwise it will only bundle x64, not x86. I don't know why yet.
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!
来源:https://stackoverflow.com/questions/51892208/uwp-with-desktop-bridge-package-build-automation-with-msbuild