In order to build with VS2017 using msbuild the command that succeeded for me was:
\path\to\msbuild.exe UWP.sln ^
/m /p:platform=x86 /p:platform=x64 /p:platform=arm ^
/p:Configuration=Release ^
/p:AppxBundle=Always ^
/p:AppxBundlePlatforms="x64|x86|ARM" ^
/p:UapAppxPackageBuildMode=StoreUpload ^
/Consoleloggerparameters:verbosity=minimal
But in order to build it with VS2019, after a lot of stress, bleeding and cursing, this worked:
First, change the content of the Package.wapproj
to have
<AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms>
<UapAppxPackageBuildMode>StoreAndSideload</UapAppxPackageBuildMode>
and then just run a single msbuild command:
\path\to\msbuild.exe UWP.sln /m ^
/p:Configuration=Release ^
/p:platform=x64 /p:platform=x86 /p:platform=arm ^
/Consoleloggerparameters:verbosity=minimal ^
/Fileloggerparameters:verbosity=quiet ^
-nodeReuse:false
This built all the platforms and package for side-loading and upload in one shot.
I had to quiet the file logger because for multi-processor build there is a race condition for multiple ilc.exe
processes where it said that ilclog.csv
could not be opened because it is used by another process. Idiotic.
I tried building each platform separately without /m
switch, and then build the package, and nothing worked, every time i had the recipe error.
They have an open bug for recipe error - https://github.com/microsoft/msbuild/issues/4930
The above solution finally did it for vs2019.
Thank you Microsoft for making our life easy with each new release of whatever, and for making documentation so helpful and resourceful.
"msbuild /p:Configuration=Release /p:Platform=x86"
--- Error:C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\DesktopBridge\Microsoft.DesktopBridge.targets(350,5): error : Could not find a recipe file for the referenced UWP application at '[..]\PackagingTest\PackagingTest.UWP\bin\Debug\PackagingTest.UWP. build.appxrecipe'. Please build the project.
– Ruperto