0
votes

I have multiple WinForms projects in Visual Studio 2017 for which the one year automated certificates have expired (or will soon.) A new self-signed certificate was created with an expiration date in 2119.

Multiple websites indicate the same steps to create the certificate. One of which is:

I have made attempts to add the PFX when signing the assembly as well as to Sign the ClickOnce Manifest, but still receive the same error messages when compiling:

  • Importing key file "CompanyFile100.pfx" was canceled. MyApplicationName
  • Cannot import the following key file: CompanyFile100.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_C0AA3FA6F491AC23 MyApplicationName

In the VS Developer Command Prompt, the command to manually install resulted in a message that the key pair already existed, so I removed and re-added the VS_KEY, but still no luck with compiling.

  • Error: "Failed to install key pair -- Object already exists."

  • sn -i CompanyFile100.pfx VS_KEY_C0AA3FA6F491AC23

  • sn -d VS_KEY_C0AA3FA6F491AC23

VS solutions have been closed and cleaned multiple times. Certificates have been removed via the certificate manager between attempts to recreate them.

Any wisdom to resolution is greatly appreciated. Should the certification be loaded at the Personal or Trusted Root CA level? Is there a limit to usage at the ClickOnce Manifest or the assembly levels?

Thanks in advance.

1

1 Answers

0
votes

An interesting, though mildly careless of me, resolution. The VS2017 solution consists of multiple projects. Though the expired certificate was removed from the system, there were several object references to the PFX file defined in multiple projects displayed in the solution explorer. Though the PFX file was deleted behind the scenes, the solution explorer reference had not been. After cleaning up the broken front-end references, the compile completed without difficulty.