MichaelDev
Friday, June 11, 2004
  Microsoft CSP and Keys with Multiple Users
We use the AssemlyKeyNameAttribute attribute in our AssemblyInfo files to set our private key. It looks like this:

[assembly: AssemblyKeyNameAttribute("MyKey")]

To use it, you store the key (in this case "MyKey") in the CSP on your machine. When your assembly gets built, it uses the key from the CSP.

We have automated builds (using Visual Build Professional from Kinook -- awesome tool!!!). As part of the process, it installs the key into the CSP. So, if you've ever done a "sn -i" operation and seen a message like this, keep reading:

Failed to install key pair -- Object already exists.

This message was very puzzling for a while. We knew the key didn't exist, but we were receiving this message. So, we tried deleting the key with "sn -d".

You get the following:

Failed to delete container 'MyKey' -- Unable to format error message 8013141C

How's that for a vague message?

So we know it failed. Finally, we figured out that the key did exist on the machine, but it was put into the CSP by a different user. We had to log on as that user and delete the key. and then we could add it under a different user.

Incidentally, you get the same message if you try to delete a key that doesn't exist:

Failed to delete container 'MyKey' -- Unable to format error message 8013141C

So that's not necessarily a clue that the key exists under a different user. It just tells you something went wrong and not why.

Microsoft really needs to iron this out. Ideally, each user on a machine should be able to save the same key name to the CSP separate from any other user and it shouldn't conflict. If that's not the case, then they CSP should be for the machine, not each user. What we have is a really strange hybrid that can cause headaches.
 
Comments:
I had the same problem, and following the steps in this blog post fixed it for me. I am running Visual Studio 2010 on Windows 2008 Server.

http://polydevmono.blogspot.com/2006/10/error-8013141c-in-visual-studio-or.html
 
Post a Comment



<< Home
Various notes on software development. Currently using C# and .Net. May also include comments on the overall software development process, etc.

Name:
Location: Orange County, California, United States
ARCHIVES
June 2004 / July 2004 / August 2004 / September 2004 / October 2004 / November 2004 / December 2004 / January 2005 / February 2005 / March 2005 / April 2005 / May 2005 / September 2005 / October 2005 / November 2005 / January 2006 / February 2006 / April 2006 / May 2006 / June 2006 / March 2007 /


Powered by Blogger