Naeem Sarfraz
Naeem Sarfraz

Reputation: 7430

Multiple projects need to use 1 SNK file

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)
       > ...

Upvotes: 13

Views: 4227

Answers (3)

Nick
Nick

Reputation: 2575

Sharing a Strong Name Key File Across Projects:

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

Upvotes: 15

Naeem Sarfraz
Naeem Sarfraz

Reputation: 7430

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.

Upvotes: 2

Nick Larsen
Nick Larsen

Reputation: 18877

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.

Upvotes: 0

Related Questions