问题
Typically when I want to build Windows 8.1 or Windows Phone 8.1 app for Store I open Visual Studio 2015 and in Solution Explorer I start Store -> Create App Packages.. wizard.
I'd like to be able to produce identical signed .appxupload packages using PowerShell ideally just providing the target project file, target platform(s), build configuration and version number.
There is a page for packaging and deployment, but I just don't know what is the proper command order to use. There must be a simple solution for this standard task, right? Note I got Windows 10 and Visual Studio 2015 Pro installed, so all prerequisites should be there.
And a bonus question, is it possible to run Windows App Certification Kit on this created package as well from PowerShell?
Thanks
回答1:
After log of digging I found the answer myself.
After associating the Project with Store and building app for Store using the Wizard and saving all changes it's then possible to build the store package again calling just 'msbuild' with the project/solution in a parameter.
I've described it in detail here:
https://www.suchan.cz/2015/09/building-windows-store-appxupload-packages-using-powershell/
回答2:
These commands work with VS2013 on a W8.1 machine and a W8.1 project. I haven't been able to verify them with VS2015/W10 yet. I suppose they should work, as long as the required W8.1 SDK is installed.
"C:\Program Files (x86)\Windows Kits\8.1\bin\x86\makeappx.exe" pack /d "<BinDirOfProject>" /p "<BindirOfProject>\output\project.appx" /l
"C:\Program Files (x86)\Windows Kits\8.1\bin\x86\makecert.exe" /n "CN=tom" /r /h 0 /eku "1.3.6.1.5.5.7.3.3,1.3.6.1.4.1.311.10.3.13" /e "01/01/2020" /sv "<BinDirOfProject>\output\key.pvk" "<BinDirOfProject>\output\key.cer"
"C:\Program Files (x86)\Windows Kits\8.1\bin\x86\pvk2pfx.exe" /pvk "<BinDirOfProject>\output\key.pvk" /pi "<Pwd>" /spc "<BinDirOfProject>\output\key.cer" /pfx "<BinDirOfProject>\output\key.pfx"
"C:\Program Files (x86)\Windows Kits\8.1\bin\x86\signtool.exe" sign /fd SHA256 /a /f "<BinDirOfProject>\output\key.pfx" /p "<Pwd>" "<BinDirOfProject>\output\project.appx"
certutil -addStore TrustedPeople "<BinDirOfProject>\output\key.cer"
You will be prompted to enter a private-public keypair when creating the certificate (makecert.exe, you can ofcourse use an existing certificate).
<Pwd>
is your private key for this certificate.
来源:https://stackoverflow.com/questions/32329223/how-to-build-windows-8-1-app-for-store-appxupload-in-powershell