Error While Signing An Assembly...

G

Guest

I have encountered an error while attempting to sign an assembly. I have
become quite frustrated since I seem to be going in circles and making no
progress. Hopefully someone will have the magic answer.

I am new to this so I will try to describe everything as well as I can.
There are probably a number of things that I am doing wrong so I will try to
desribe the errors that I am receiving along with things that I have tried
and observations and questions.

I have picked up a handful of projects from another developer that use a
..SNK file to sign the assemblies. When I attempt to compile a project, a
CS1548 compiler error is generated with the text "Cryptographic failure while
signing assembly <assembly name> -- 'The key container name <key container
name> does not exist".

In order to try to fix this error, I executed the command "sn -i <key
container name> <key file>".

When I compile, a different error message is generated. This time, a CS1606
compiler error is generated with the text "Assembly signing failed; output
may not be signed -- The system cannot fine the file specified".

It seems like I cannot resolve either of these two error messages (or if I
resolve one the other one appears).

The .SNK file I am using was generated on another machine. Are .SNK files
machine specific? If so, this may be a source of a problem.

The project is using an AssemblyKeyNameAttribute. When I compile, I also
receive a warning that I should use the command line option /keycontainer or
appropriate project settings instead of AssemblyKeyNameAttribute. The help
file (for Visual Studio 2005) appears to make no mention of this attribute
when describing how to sign an assembly. Could this also be part of the
problem?

If anyone can make sense out of this mess it will be greatly appreciated.

Thank you,

Jason Richmeier
 
G

Gary Chang[MSFT]

Hi Jason,

Thank you posting!

Singing an assembly in VS2005 adopts a different approach from VS2003.
Instead, you can specify the name of the .snk file in a property of the
project, just right-click on the project in the solution explorer and
select Properties. Then click on the Signing tab. The path to the .snk
file can be specified there.
I suggest you can specify the original .snk file which you get with the
projects, and comment out the corresponding AssemblyKeyNameAttribute code
line.

How to: Sign an Assembly (Visual Studio)
http://msdn2.microsoft.com/en-us/library/ms247123.aspx

If the above method still does not work, then the original .snk file may be
corrupted. In this regard, you can create your own .snk file. Just type the
command line: sn -k mykey.snk and move resulting mykey.snk to a folder
where you likely to put your development files. Then use the above approach
to specify that key file for signing the assembly.


Thanks!

Best regards,

Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top