How to integrate Makeappx.exe command in postbuild event of VS2015 to create appx for the current solution?

964 Views Asked by At

I have created win32 .Net desktop application. I want to create appx bundle for my solution on every post-build event using makeappx.exe tool. When I am running command on post build event : MakeAppx pack /d input_directorypath /p filepath.appx ,it fails with error code 9009. I don't know why this is giving error as when I run this command using developer command prompt, it gives desired output. I also noticed that when I run above command using normal command prompt it gives same error. Please help on this.

1

There are 1 best solutions below

2
On

I have tested your command and reproduced your issue. The problem is that when you run command on post build event, it did not found makeappx.exe tool. The command is incomplete. Below is a complete command.

"C:\Program Files (x86)\Windows Kits\10\bin\x64\MakeAppx.exe" pack -d "C:\test1\VLCUWPApp\PackageFiles" -p "C:\test1\VLCUWPApp\VLCUWPApp.appx"

For your requirement, you could add C:\Program Files (x86)\Windows Kits\10\bin\x64 path to Environment Variables, and then you could successfully run the command that you have mentioned.

Please note if the appx package already exists in destination path, the post build event will be stuck. Because it's waiting for you to input "Y" to cover the old package. However, currently it did not provide inputting interface. So you should remove the old package manually.