Strong Name Key (SNK) File

T

Tackie

1. After I use "sn -k MyKey1.snk" the snk file is created.
2. I then goto my solution and add an existing item.
3. Select the key file I just created
4. It is added to my solution
5. when I click it to edit the assembly data the file opens as a garbage
text file within .Net

I'm I missing something here? The key file when created also does not have
the "key/lock" icon in explorer.

Thanks for any help.
 
M

Martin Robins

Strong name signing is acheived using the AssemblyKeyFile attribute; usually
in the AssemblyInfo.cs/vb source file. You do not simply add it to the
project.
 
S

Scott M.

After you create the key file, you leave it where it is.
You then open the AssemblyInfo.vb/cs file and add the
AssemblyKeyFileAttribute.
Since this file is compiled into your project (AssemblyInfo.vb/cs), your
assembly will now have an association to the strong name in the .snk file.
The assembly could now be placed into the GAC if desired.
 
O

Olaf Baeyens

Go to your assembly.cs file (if you have C#) and a search for
AssemblyKeyFile
Then there add your MyKey1.snk file
Something like this.

[assembly: AssemblyKeyFile("..\\..\\MyKey1.snk")]

Remember NEVER to distribute your MyKey1.snk ever otherwise people might use
it and pretend that they are you.
And for all the projects you ceate use that same MyKey1.snk file, this way
people can configure .NET to trust your application only once and every
program that you deliver will be trusted automatically (assuming you do not
use version inumber in the trust)

Ik hope this helps?
 

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,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top