Distribute UWP apps outside Microsoft Store
Microsoft Store is the worst app store. There are also other reasons for distributing UWP apps outside Microsoft Store.
The steps to do it:
- Obtain a code signing certificate.
- Follow the instructions from the certificate authority (CA) to get the certificate file. It may have extension .p12. Make a copy of this file and change the extension to .pfx that is used by Visual Studio.
- For cross-platform projects, the UWP project's Assets folder must have the logo images (it is usually sufficient if the shared folder has them).
- Right-click UWP app in VS Solution Explorer> Publish > Create App Packages... > Select "Sideloading" and "Enable automatic updates"> Remove the default certification > Select From File... > Select the certificate .pfx file > Next > Generate app bundle: Always, select release versions of x86, x64, ARM for Architecture > Select every "1" Weeks. A VS bug does not allow the update checking interval greater than 1 week. > Create.
- Modify index.html by by removing 'ms-appinstaller:?source=' to deal with a Microsoft bug (e.g., change <a href='ms-appinstaller:?source=https://www.mydomain.com/download/myapp.appinstaller'> to <a href='https://www.mydomain.com/download/myapp.appinstaller'>).
- Copy a. folder My_APP_x.x.x.x_Test, b. index.html, c. My_APP.appinstaller to a directory of a web project (e.g. corresponding to URL: www.mydomain.com/download.myapp.
- Add a web.config file to the same folder for IIS with meme type contents for UWP app distribution.
It is a significant nuisance to switch the project back to the Microsoft Store version:
1. Right-click the project name > Publish > Associate App with the store...
2. Right-click the project name > Properties > Package Manifest... > Packaging > Choose Certificate > Select from file... >Select the one created automatically for the app (e.g. MY_APP.UWP_TemporaryKey.pfx)
To renew the code signing certificate:
- Order renewal.
- Download DeigiCertUtil
- Click "Create CSR" and import the attributes from the certificate to be renewed.
- Make sure to choose 4096 bit to avoid the error "Code Signing: ErroCode:-13 ErrorMessage: Error during placing order"
- Generate.
- Copy CSR and/or save it to a file.
- Go to the order list of the account on the certificate vendor's website.
- Click GENERATE NOW for the renewal order.
- Paste CSR to the form and fill out other fields.
- Submit
- Click Validation Manager in the received email to upload the driver's license and portrait with the license held near the face, and company documents (e.g., state annual reports).
- An email will arrive after the documents are accepted. Click the link to initiate a callback to verify the phone. An automatic phone call will take place to inform a pin number that should be entered on the callback page.
- Certificate is issued.
- Follow the instructions to install and export the certificate.