VisualStudio.com cannot load temporary UWP certificate during build

I set up my Team Team Visual Studio account to clone my private GitHub repo and create a Windows UWP application anytime I queued up for the build. Cloning works without any problems; compilation of each project (6) works, except for one. UWP application project for Windows.

I get the following warnings when the build server compiles the application:

C: \ Program Files (x86) \ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ AppxPackage \ Microsoft.AppXPackage.Targets (1778.5): Warning APPX0104: The certificate file 'myapp_TemporaryKey.pfx' was not found.

2> C: \ Program Files (x86) \ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ AppxPackage \ Microsoft.AppXPackage.Targets (1778.5): warning APPX0104: certificate file "myapp_TemporaryKey.pfx" was not found. [C: \ a \ 1 \ s \ Source \ Applications \ myapp.WindowsUWP \ myapp.csproj]

C: \ Program Files (x86) \ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ AppxPackage \ Microsoft.AppXPackage.Targets (1778.5): Warning APPX0102: certificate with fingerprint "58F2EA544193F6FC9F2737135570555B388E58D8" specified in the project cannot be found in the certificate store. Specify the file in the project file.

2> C: \ Program Files (x86) \ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ AppxPackage \ Microsoft.AppXPackage.Targets (1778.5): warning APPX0102: certificate with fingerprint "58F2EA544193F6FC9F2737135570555B388E58D8", which is specified in the project, not can be found in the certificate store. Specify the file in the project file. [C: \ a \ 1 \ s \ Source \ Applications \ myapp.WindowsUWP \ myapp.csproj]

C: \ Program Files (x86) \ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ AppxPackage \ Microsoft.AppXPackage.Targets (1778.5): Warning APPX0107: The specified certificate is not valid for signing. For more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478 . 2> C: \ Program Files (x86) \ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ AppxPackage \ Microsoft.AppXPackage.Targets (1778.5): Warning APPX0107: The specified certificate is not valid for signing. For more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478 . [C: \ a \ 1 \ s \ Source \ Applications \ myapp.WindowsUWP \ myapp.csproj]

This is the last project of 6 to compile. After receiving warnings, he proceeds to copy all the output files to the final / bin directory. Then, when all this is done, he will send the same messages as above, but like errors this time he will not complete the assembly.

_GenerateAppxPackageFile: C: \ Program Files (x86) \ Windows Kits \ 10 \ bin \ x64 \ MakeAppx.exe pack / l / h sha256 / f obj \ x86 \ Debug \ package.map.txt / o / p C: \ a \ 1 \ s \ Source \ Applications \ MyApp.WindowsUWP \ AppPackages \ MyApp_1.0.0.0_x86_Debug_Test \ MyApp_1.0.0.0_x86_Debug.appx
MyApp → C: \ a \ 1 \ s \ Source \ Applications \ MyApp.WindowsUWP \ AppPackages \ MyApp_1.0.0.0_x86_Debug_Test \ MyApp_1.0.0.0_x86_Debug.appx C: \ Program Files (x86) \ MSBuild \ Microsoft \ VisualStudio \ v14 .0 \ AppxPackage \ Microsoft.AppXPackage.Targets (2382.5): Error APPX0104: The certificate file 'MyApp_TemporaryKey.pfx' was not found. 2> C: \ Program Files (x86) \ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ AppxPackage \ Microsoft.AppXPackage.Targets (2382.5): error APPX0104: certificate file 'MyApp_TemporaryKey.pfx' not found. [C: \ a \ 1 \ s \ Source \ Applications \ MyApp.WindowsUWP \ MyApp.csproj] C: \ Program Files (x86) \ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ AppxPackage \ Microsoft.AppXPackage.Targets (2382 , 5): error APPX0102: certificate with fingerprint "58F2EA544193F6FC9F2737135570555B388E58D8", which is specified in the project, cannot be found in the certificate store. Specify the file in the project file. 2> C: \ Program Files (x86) \ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ AppxPackage \ Microsoft.AppXPackage.Targets (2382.5): error APPX0102: certificate with fingerprint "58F2EA544193F6FC9F2737135570555B388E58D8", which cannot be specified in the project be found in the certificate store. Specify the file in the project file. [C: \ a \ 1 \ s \ Source \ Applications \ MyApp.WindowsUWP \ MyApp.csproj] C: \ Program Files (x86) \ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ AppxPackage \ Microsoft.AppXPackage.Targets (2382 , 5): Error APPX0107: The specified certificate is not valid for signing. For more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478 ., 2> C: \ Program Files (x86) \ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ AppxPackage \ Microsoft .AppXPackage.Targets (2382.5): error APPX0107: The specified certificate is not valid for signing. For more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478 . [C: \ a \ 1 \ s \ Source \ Applications \ MyApp.WindowsUWP \ MyApp.csproj] 2> Done Building Project "C: \ a \ 1 \ s \ Source \ Applications \ MyApp.WindowsUWP \ MyApp.csproj" ( default goals) - FAILED. 1> Done Building Project "C: \ a \ 1 \ s \ Source \ MyApp.UWP.sln" (default goals) - FAILED. Build FAILED. "C: \ a \ 1 \ s \ Source \ MyApp.UWP.sln" (default target) (1) →

If I simply delete the certificate (as I did in this particular error log), it fails because it cannot find it. If I generate a certificate using the manifest editor in VS and assign it a password, the build server will fail because it does not know the password. Therefore, I cannot force it to create whether I provide a temporary test certificate or not.

How should we run UWP Windows 10 applications through the Team Team Visual Studio build system? This is what Microsoft has been encouraging for a while, so I suggested that it could be done. I can't seem to build a UWP project.

+6
source share
2 answers

You can create a certificate without a password.

Or, add a PowerShell step to the assembly definition to import the password-protected certificate. The following is a powershell script option that you can use:

$pfxpath = 'myapp_TemporaryKey.pfx' $password = 'yourpassword' Add-Type -AssemblyName System.Security $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 $cert.Import($pfxpath, $password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]"PersistKeySet") $store = new-object system.security.cryptography.X509Certificates.X509Store -argumentlist "MY", CurrentUser $store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]"ReadWrite") $store.Add($cert) $store.Close() 

Remember to set the "Working Folder" to the path where your pfx file is located.

+4
source

By default .gitignore ignores any *.pfx file. Therefore, it is not added to git. I had the same problem that there is no *_StoreKey.pfx file on the build machine, so the build failed.

For me, the solution was to install *_StoreKey.pfx on the build server. Then creating the solution on the build server will succeed.

+2
source

All Articles