Search code examples
.netvisual-studiovisual-studio-2008strongnamesnk

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

Solution

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