Home All Groups Group Topic Archive Search About

creating and using strongly named assembly

Author
27 Nov 2007 3:33 PM
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



*** Sent via Developersdex http://www.developersdex.com ***

Author
27 Nov 2007 3:44 PM
not_a_commie
Add the key file in the project settings GUI and it will do all that
for you.
Author
27 Nov 2007 4:01 PM
Mike P
What do you mean by the 'Project Settings GUI'?



*** Sent via Developersdex http://www.developersdex.com ***
Author
28 Nov 2007 3:28 PM
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.
Author
27 Nov 2007 4:30 PM
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.


--
          - Nicholas Paldino [.NET/C# MVP]
          - mvp@spam.guard.caspershouse.com

Show quote
"Mike P" <mike.p***@gmail.com> wrote in message
news:OA09brQMIHA.2208@TK2MSFTNGP06.phx.gbl...
>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
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***

AddThis Social Bookmark Button