user7688277
user7688277

Reputation:

UWP certificate issue on hosted agents

I'm trying to run UWP build using Team Foundation Server and App Center and it gives me this error.

 ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(3090,5): Error MSB3325: Cannot import the following key file: AppCenterTest.UWP_TemporaryKey.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_480BF88F6934FA8C

I tried creating a private agent for Team Foundation Server which fixed the issue for Team Foundation Server only since the certificate is installed on my private agent. But for App Center by default is running a hosted agent.

How to resolve this issue? Thanks.

Upvotes: 0

Views: 498

Answers (2)

user7688277
user7688277

Reputation:

Instead of Creating a test certificate in Package.appxmanifest > Packaging > Choose Certificate. I create the certificate in my UWP project Properties > Signing > Choose a strong name key file: > New. This steps resolved my issue.

Upvotes: 1

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51183

Take a look at below statement:

Select the right type of build agent

Choose the type of build agent that you want VSTS to use when it executes the build process. A hosted build agent is deployed with the most common tools and sdks, and it will work for most scenarios, see the Software on the hosted build server article. However, you can create a custom build agent if you need more control over the build steps. You can use the following table to help you make that decision.

enter image description here

Note: If you plan to target the Windows Anniversary Update SDK (Build 14393) you will need to set up your custom build agent, since the hosted build pool only supports SDK 10586 and 10240. More information to choose a UWP version

Besides, if you use a Git repository, add the certificate file of your project to the repository so that the build agent can sign the appx package. If you don’t do this, the Git repository will ignore the certificate file. To add the certificate file to your repository, right-click the certificate file in Solution Explorer, and then in the shortcut menu, choose the Add Ignored File to Source Control command.

enter image description here

More details please refer this tutorial: Set up automated builds for your UWP app

Upvotes: 0

Related Questions