AssemblyKeyFile attribute

G

George Durzi

Sorry to double post, but I figured I would get a better response here.


Trying to assign a strong name to my assembly. I've created the .snk file
for it.
My assembly is called Common. Mail

In Assembly.cs, if I do this:
[assembly: AssemblyKeyFile(@"C:\Program Files\Microsoft Visual Studio .NET
2003\SDK\v1.1\Bin\Common.Mail.snk")]
it works great, but I don't wanna hardcode the path to the bin directory,
since it might change.

In the help documenation, they had it shown as
[assembly: AssemblyKeyFile(@"..\..\Common.Mail.snk")]
but that doesn't work ...

I'm assuming ..\..\ was trying to get to the v1.1\Bin directory but wasn't.
How do I do this without hardcoding the path
 
B

Brian Parlier

[assembly: AssemblyKeyFile(@"..\..\Common.Mail.snk")]

is using relative pathing to the keyfile location (not the bin).

I generally create a common directory for key files and point the attribute
to that location. This for security as well as ease of maintance. The key
file contains the private portion of the key. If this becomes compromized
then there is a potential for a hack.

Good luck,
Brian Parlier
 

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

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top