20
Unable to build the assembly: 
C: \ Program Files (x86) \ MSBuild \ 12.0 \ bin \ amd64 \
Microsoft.Common.CurrentVersion.targets (2696): Cannot import the following key file: 
MyKey.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_977DBD18D1081093 

I have read many posts, but none of them helped me. How can I install the certificate if I physically do not have access to the server and I can not call the command sn.

cpoDesign
  • 8,953
  • 13
  • 62
  • 106
user3733837
  • 201
  • 1
  • 2
  • 4
    The company we bought our TTS from offer support for anything. At the price you pay for them the support is included. I suggest your check with them. They configured our license and TTS server at distance no cost. – Franck Jun 12 '14 at 11:40
  • 4
    You can run a powershell command build task (and do a Import-PfxCertificate). https://stackoverflow.com/a/42091371/928553 – less Sep 22 '17 at 07:06
  • 1
    I'm not exactly sure in what way you're trying to import certificate there, but please have in mind that pfx is not equal to private key. A pfx is a file combining certificate content, pub key and private key (possibly with passphrase for the prv key) – Zegar Nov 05 '17 at 18:26
  • It seems like your using this certificate for code signing. This thread may be helpful: https://stackoverflow.com/questions/1056997/team-foundation-server-build-with-password-protected-codesigning-fails – qbik Nov 08 '17 at 04:45

1 Answers1

1

Hi Use powershell script to do this ,

I also faced the same issue , but if physical access is not there , application access or script execution access should be there other wise it is not possible

  1. First create passoword

  2. Import-PfxCertificate -FilePath "yourfile.pfx" -Password $yourPassword Cert:certificateLocation

Also if you have build service account then

  • Logon to the build machine using the build service account

  • Run msbuild on any project that uses this signing key. It will prompt for the password and will export the key.

  • Now start the TeamBuild full build.

Shaswata
  • 1,049
  • 1
  • 9
  • 27