sn.exe error "Failed to generate a strong name key pair -- The keyset is not defined" Thread Tools Rate Thread
Posted on 2010-05-27 12:49 sunrack 阅读(594) 评论(0) 编辑 收藏 举报Ever since installing vs.net 2003, I have been receiving an error
whenever I tried to generate a key using sn.exe. This was the output
<paste>
C:\>sn -k c:\testkey.snk
Microsoft (R) .NET Framework Strong Name Utility Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Failed to generate a strong name key pair -- The keyset is not
defined.
<end paste>
Search as I might, I was not able to find a solution to the problem,
although I did find several posts about the problem. The suggested
fixes (which did not work for me) were to check & fix file permissions
(permissions were fine though) and to reinstall the .net framework.
After digging around on my machine for a bit, I found that the problem
was with the Cryptographic Service Provider. doing a sn.exe -c reset
it to default, and allowed me to generate a key pair.
<paste>
C:\>sn -c
Microsoft (R) .NET Framework Strong Name Utility Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Default CSP reset
C:\>sn -k c:\testkey.snk
Microsoft (R) .NET Framework Strong Name Utility Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Key pair written to c:\testkey.snk
<end paste>
--SDF