creating and using strongly named assembly

M

Mike P

I have a class library that I want to make into a strongly named
assembly. I have used the command line to create the key and added the
..snk file to my class library, and have now tried to add the following
to the AssemblyInfo.cs :

[assembly: AssemblyKeyFileAttribute("Email.snk")]

But I get the error :

Warning 1 Use command line option '/keyfile' or appropriate project
settings instead of 'AssemblyKeyFileAttribute' C:\Documents and
Settings\michaelp\My Documents\Visual Studio
2005\EmailChecker\EmailChecker\EmailChecker\Properties\AssemblyInfo.cs 3
7 12 EmailChecker

Can anybody tell me why I am getting this error?


Thanks,

Mike
 
N

Nicholas Paldino [.NET/C# MVP]

Mike,

Before .NET 2.0, the assembly was used to indicate the location of the
key file. However, the path to the key file was baked into the assembly,
and it was considered a security risk.

So, in .NET 2.0, the location of the key was passed to the compiler, and
it signed the key at compile time without the attribute.

This is why you are getting the error. As not_a_commie says, you have
to go to your project, right click and select "properties". In the window
that comes up, select the build tab, which will then have an area where you
can set the strong name key file which will sign your assembly.
 
N

not_a_commie

What do you mean by the 'Project Settings GUI'?

I mean double click on the project Properties and then go to the
Signing tab.
 

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