I'm trying to fully automate my msix builds for an Avalonia desktop application. My solution has 3 projects: desktop UI, a class library, and a WAP (Windows Application Project) project.
I can create the msix file easily via launching the solution in Visual Studio, right-clicking the WAP project, selecting 'Publish', then 'Create App Packages', and going through the next 2 dialogs, accepting the current settings (no changes).
I'd like to automate this though - I assume it can be done via msbuild, but I must have some command line arguments missing. This is what I have:
msbuild "...path to the solution...\test.sln" /restore /p:GenerateAppxPackageOnBuild=true
I don't need to change any settings in the WAP project - the current settings are fine. That's why I leave out switches such as "/p:AppxBundle=Never" and "/p:Configuration=Release" - these are already saved in the WAP project - I have tried including them, but the build still fails.
I found the answer - posting here if anyone has the same problem:
My original msbuild 'restore' syntax was wrong - in addition I needed both "RuntimeIdentifiers=win-x64" and "GenerateAppxPackageOnBuild=true". The command line that works for me is:
msbuild "..path to the solution..\test.sln" /t:restore,build /p:RuntimeIdentifiers=win-x64 /p:GenerateAppxPackageOnBuild=true
The "/t:restore" is necessary since my builder copies the solution and makes some changes before building.