13

I'm using Visual Studio 2008 and I have a solution which contains multiple projects. I have 1 snk to sign my assemblies and this lives in a solution folder.

I've linked the snk to each of my projects but now when I attempt to sign my project with that linked snk I can't find the snk file with the file dialog.

Have I missed a step here?

Solution
   > Solution Folder
       MyKey.snk
   > Project X
       > _LinkedFiles
           MyKey.snk (physical file doesn't appear here but shows in VS)
       > ...
abatishchev
  • 98,240
  • 88
  • 296
  • 433
Naeem Sarfraz
  • 7,360
  • 5
  • 37
  • 63

3 Answers3

15

Sharing a Strong Name Key File Across Projects:

http://blogs.msdn.com/shawnfa/archive/2006/04/24/582278.aspx

Nick
  • 2,555
  • 1
  • 20
  • 18
2

Well, not much response here but I did find a solution I was comfortable with. I've got a ProductAssemblyInfo which lives in a solution folder but is linked to each project as below.

Solution
   > Build (Solution Folder)
       MyKey.snk
       ProductAssemblyInfo.cs
   > Project X
       > _LinkedFiles
           ProductAssemblyInfo.cs
       > ...

The ProductLevelAssembly contains the following line:

[assembly: AssemblyKeyFile("../../Build/MyKey.snk")]

That way the key file never gets copied into each project but each assembly is still signed by the key.

Naeem Sarfraz
  • 7,360
  • 5
  • 37
  • 63
0

Don't link it, just make copies of it. If you rebuild the SNK, you will need to copy it to all the projects again, but the likelihood of needing to do that is VERY low. In fact, we only change SNKs when modifying major version numbers.

Also when you link a file, you are linking it in the solution file, not making a copy which edits both places at once. The browse dialog is only going to show you files which exist on the drive.

Nick Larsen
  • 18,631
  • 6
  • 67
  • 96
  • This answer will technically work. But remember, your PRIVATE key file (.snk) is like the thing that says "We are who we say we are"......thus having copies of it could be a security risk. So I agree with the answer, but it comes with a disclaimer (IMHO). – granadaCoder Dec 14 '12 at 17:33