Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GlobalAssemblyInfo.cs and strong naming

I have a GlobalAssemblyInfo.cs file in the root of my solution, and I have something like the following entry in it to enable strong naming of my output assemblies.

#pragma warning disable 1699
[assembly : AssemblyKeyFile("..\\keyfile.snk")]
#pragma warning restore 1699

This approach has two drawbacks. Firstly, AssemblyKeyFileAttribute is deprecated, and so to avoid compilation warnings I need the pragma lines you see above. Secondly, I either need to keep all my projects at the same depth relative to the root to use the relative path, or use an absolute path, which dictates a checkout location on other users' machines (and on continuous integration servers/build agents).

Does anyone have a better solution than this, other than going through each project setting strong naming in the project file?

like image 567
David M Avatar asked Apr 03 '09 15:04

David M


1 Answers

Well, to avoid the path problem you can use [assembly:AssemblyKeyName(...)] instead (although IIRC this is also deprecated); use sn -i to install a named key. Each machine (that does builds) would need this key adding.

Other than that; yes, you'd probably need to edit the project files.

like image 98
Marc Gravell Avatar answered Sep 22 '22 16:09

Marc Gravell