Cryptographic failure while signing assembly

Today I encountered the following error whilst building a solution using Visual Studio 2008:

Cryptographic failure while signing assembly ‘SomeAssembly.dll’ — ‘The key container name ‘KeyName’ does not exist’

When I tried to create the key manually by typing the following in the Visual Studio 2008 command prompt:

sn.exe -i MyKey.snk KeyName

I got the following error:

Failed to install key pair — Object already exists.

When I tried to delete the key:

sn -d KeyName

I got another error:

Failed to delete container ‘KeyName’ — Unable to format error message 8013141C

The solution is to explicitly take ownership of all files in C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys. Please refer to Cory Trese’s blog post for more details.

11 September 2008 | .NET | Comments

Comments:

  1.  
  2.  
  3.