microsoft / devops-for-windows-apps

Sample Windows app to show devops best practices
MIT License
61 stars 27 forks source link

Choosing a certificate in Visual Studio with the MSIX app manifest #24

Closed gradyal closed 5 years ago

gradyal commented 5 years ago

I'm following along in the video, but I'm having trouble seeing an option in Visual Studio that the presenter in the video uses at the 28:00 mark in the video. I'm using Visual Studio Enterprise 2019 version 16.1.1 with .NET Framework 4.7.03190. My problem is when I open the appxmanifest display > click the Packaging tab > click Choose Certificate > Select a Certificate > I do not see the More choices selection option as seen in the video. I've been looking through documentation but cannot see how to enable this option. I'd like to be able to select a self-signed certificate. Please advise.

Screen capture from video: image

Screen capture from my Visual Studio: image

rido-min commented 5 years ago

Hi @gradyal sorry for the confusion, in the session I used an internal VS preview where the certificate management is being redesigned.

The more choices option is shown only when you have more than one Code Signing certificate in your CurrentUser\My certificate store.

If you want to create a new self signed certificate to sign MSIX packages you can use the next command:

 New-SelfSignedCertificate -Subject "CN=Joey, O=Ramones, L=Queens, S=NewYork, C=US" `
    -FriendlyName Joey `
    -Type CodeSigning `
    -KeyUsage DigitalSignature `
    -KeyLength 2048 `
    -KeyAlgorithm RSA `
    -HashAlgorithm SHA256 `
    -TextExtension @('2.5.29.37={text}1.3.6.1.5.5.7.3.3', '2.5.29.19={text}Subject Type:End Entity') `
    -Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" `
    -CertStoreLocation "Cert:\CurrentUser\My"

Then you should be able to select it from the certificate picker under the More choices option.

/c @mirkomuggli

gradyal commented 5 years ago

Thank you @rido-min! I had generated a self-signed cert, but it was in LocalMachine. I ran your script above and now I see the more choices option.