strong naming assembly

D

Derrick

I am attempting trying to create an assembly with strong name

Here is what I have done:
called sn -k Tesstkey.snk
placed this code in my class:
using System.Reflection;

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

I am getting an error saying it cannot read the key file

First, Where should that .snk file go?
Second, What could cause that error?

Derrick
 
S

Shiva

Hi,

You can give absolute path also for the .snk file.

I believe VS.NET IDE looks for the .snk file in the devenv.exe folder
itself.

I am attempting trying to create an assembly with strong name

Here is what I have done:
called sn -k Tesstkey.snk
placed this code in my class:
using System.Reflection;

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

I am getting an error saying it cannot read the key file

First, Where should that .snk file go?
Second, What could cause that error?

Derrick
 
S

Steven Cheng[MSFT]

Hi Derrick,

As for the making stong-named asembly issue, I think you Shiva's suggestion
that use the full absolutte path of the key file is reasonable. Since
you're using the relative path of the file(haven't specify the full path),
I'm not sure whether the problem is cause by this. Anyway, please have a
try and if you have anyother findings, please also feel free to post here.
Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
N

Nicole Calinoiu

Derrick,

You can use a relative path for this, but it should be relative to the
compiled assembly, not the project file. For example, if you keep the key
file in the project root folder and your assemblies get compiled to <project
root>\bin\debug or <project root>\bin\release, then your relative path must
point up two directories. e.g.:

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

HTH,
Nicole
 
D

Derrick

Thanks for the help.

physical path wouldn't work because I have to move the projects between
machines. I used Nicole's suggestion to use the relative path of
"..\..\file.snk", and that worked. I had the file in the \bin\release\
folder, so that should have worked, but I can work with the relative path
approach.

Derrick
 
D

Derrick

Thanks, Nicole

That worked

Derrick
Nicole Calinoiu said:
Derrick,

You can use a relative path for this, but it should be relative to the
compiled assembly, not the project file. For example, if you keep the key
file in the project root folder and your assemblies get compiled to <project
root>\bin\debug or <project root>\bin\release, then your relative path must
point up two directories. e.g.:

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

HTH,
Nicole


Derrick said:
I am attempting trying to create an assembly with strong name

Here is what I have done:
called sn -k Tesstkey.snk
placed this code in my class:
using System.Reflection;

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

I am getting an error saying it cannot read the key file

First, Where should that .snk file go?
Second, What could cause that error?

Derrick
 

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