Signing assemblies with strong name using pfx and visual studio

I own a Comodo (.p12) certificate and ran into the same issue and solved it based on @SmithPlatts answer and @Ares comment. Here is a detailed walkthrough for those who are not savvy (like me) with certificates:

  1. Open Command Prompt with admin privileges.
  2. Type command: certutil -importPFX "<certFilepath>\<certFilename>.p12" AT_SIGNATURE (AT_SIGNATURE is what makes this work instead of [Right-click .p12 file]-->'Install PFX')
  3. Type a password of your choice.
  4. Open mmc.exe with admin privileges, File-->Add/Remove Snap-in...
  5. Add 'Certificates'
  6. Choose 'Computer Account'
  7. Under Console Root/Certificates (Local Computer)/Personal/Certificates locate your certificate installed by step 2.
  8. Right click Cert/All Tasks/Export-->Next/Yes, export the private key
  9. Go to 'Personal Information Exchange - PKCS #12 (.PFX)'
  10. Uncheck 'Include all certificates...'. Important! If checked VS will produce this message: "Cannot find the certificate and private key for decryption" when signing.
  11. Check 'Export all extended properties' (Optional).
  12. You can check 'Delete the private key...' if you are not planning to re-export in the future.
  13. Tick password and type the password of step 3.
  14. Choose file path and file name for the exported (.pfx) certificate.
  15. Use exported .pfx file to sign your assembly/project from VS.
  16. Build project to make sure that pfx works properly.

I have just encountered the same issue and this article saved my bacon!

All I needed to do was recreate my Code Signing cert with KeySpec set to 2 (AT_SIGNATURE) and now VS (2013) imports and signs my assembly without error! :-D

I realize that this is a bit different to your scenario, but I hope this can help in some way ...