One Visual Studio solution needs a self-signed certificate to work.
We used to make one in cmd
as administrator with this command:
makecert -n "CN=TempCA" -r -sv TempCA.pvk TempCA.cer
And when finished, we ran this:
makecert -sr LocalMachine -ss My -a sha1 -n CN=MyTestCert -sky exchange -pe -ic TempCA.cer -iv TempCA.pvk
This works on Windows 10, but we just got upgraded to Windows 11 and now makecert
is not compatible anymore.
How do I translate this to the PowerShell variant New-SelfSignedCertificate
?
You can create a new self-signed certificate using this command (replace the values in angle brackets):
New-SelfSignedCertificate -Type Custom -Subject "CN=<PublisherName>" -KeyUsage DigitalSignature -FriendlyName "<Certificate firendly name>" -CertStoreLocation "Cert:\CurrentUser\My" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}")
To see the certificates you've created, use this command:
Get-ChildItem "Cert:\CurrentUser\My" | Format-Table Thumbprint, Subject, FriendlyName
I've taken this information from Publish a packaged .NET MAUI app for Windows with the CLI; if copy-pasting the command from this comment doesn't work, try copying it directly from this article.