This article explains how to renew the PFX certificate for your Windows 10 / 8.1 app created with Tools for Apache Cordova in Visual Studio. The certificate is valid for just one year, so it must be renewed to rebuild the app.
You receive the following error when building your Windows (Tools for Apache Cordova) app from Visual Studio, targeting Windows 10:
Warning APPX0108 The certificate specified has expired. For more information about renewing certificates, see http://go.microsoft.com/fwlink/?LinkID=241478
The default certificate that Visual Studio generates expires one year after the date on which the certificate was created. If you try to build your app after that year, the build will process will fail.
Follow these steps to create a new certificate valid for another year:
Close your Tools for Apache Cordova project from the File > Close Solution menu.
Go to File > Open > Project/Solution. Select the CordovaApp.sln file from the platforms/windows folder and open it:
In the Solution Explorer, you should see a series of solutions for different platforms:
Expand any of them and locate the package.windows.appxmanifest file. Open it by double clicking on it.
Switch to the Packaging tab, locate the Publisher section, and click the Choose Certificate button. A dialog like this will show up:
From the Configure Certificate drop down, select Create test certificate and enter your certificate’s Publisher Common Name and password:
You should use the same Common Name from your previous certificate. Save this file from the File menu and close it.
For the other platforms
If you have other platforms created, such as Windows 8.1, you can either:
- Repeat the same process to create new certificates
- Reuse the PFX certificate you’ve just created in the previous platform
Note: I’m not sure of the implications of reusing the same certificate, but that’s the option I prefer to use and I had no problems with it so far.
After updating all certificates, select File > Save All and close the solution. Now open your Tools for Apache Cordova solution, and run a test build, the certificate error APPX0108 should be gone.
The certificate renewal process, along with other options, can also be found in the Renew a Certificate section from the Manage the certificates that Visual Studio uses to sign your app Microsoft Docs article.