[Mono-list] How to use the Mono GAC

Jonathan Stowe mono-list@lists.ximian.com
Thu, 27 May 2004 18:18:34 +0100


On Thu, 2004-05-27 at 17:47, Andrew Arnott wrote:
> Can someone please point me to documentation on how to:
> 
>      1. Make an assembly that is just a regular ol’ assembly become
>         strong named (if necessary)

First you create your key pair with sn:
 
     sn -k foo.snk

and then reference this key pair in the source code:


    [assembly: AssemblyKeyFile("foo.snk")]

This can be in a separate (assemblyInfo.cs) file or in your main code
file.  You will need to include the appropriate namespaces:
 
   using System.Reflection;
   using System.Runtime.CompilerServices;



 
  
>      1. Install it into the GAC

   gacutil /i MyDll.dll

>      1. Reference that GAC assembly from other assemblies
> 

mcs /r:MyDll MyCode.cs


And hey presto!