PC Review


Reply
Thread Tools Rate Thread

creating and using strongly named assembly

 
 
Mike P
Guest
Posts: n/a
 
      27th Nov 2007
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 ***
 
Reply With Quote
 
 
 
 
not_a_commie
Guest
Posts: n/a
 
      27th Nov 2007
Add the key file in the project settings GUI and it will do all that
for you.
 
Reply With Quote
 
Mike P
Guest
Posts: n/a
 
      27th Nov 2007
What do you mean by the 'Project Settings GUI'?



*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      27th Nov 2007
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]
- (E-Mail Removed)

"Mike P" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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 ***



 
Reply With Quote
 
not_a_commie
Guest
Posts: n/a
 
      28th Nov 2007
> What do you mean by the 'Project Settings GUI'?

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

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Assembly in GAC, Page Inherits Strongly Named Assembly? john@johnwpowell.com Microsoft ASP .NET 0 3rd Dec 2005 01:31 PM
Strongly named assembly can reference only other Strongly named assembly San Microsoft C# .NET 1 4th Feb 2005 04:13 AM
convert a weakly named assembly to a strongly named =?Utf-8?B?QXZpbiBQYXRlbA==?= Microsoft Dot NET 3 21st Jan 2005 07:37 PM
strongly named .net assembly in IE Brett Microsoft Dot NET 0 29th Sep 2004 07:46 PM
.NET assembly : strongly named DotNetJunkies User Microsoft VB .NET 1 27th Jul 2004 01:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:50 AM.