This documentation is archived and is not being maintained.

How to: Install Assemblies in the Global Assembly Cache

The global assembly cache operates no differently in the .NET Compact Framework than in the full .NET Framework.

To install resources files, such as DLLs, into the global assembly cache

  1. Place the resource files into a directory on the device.

  2. Create a text file that lists each file and its path on a separate line.

  3. Save the text file with a .gac extension into the Windows directory on the device.

    Assembly files can be ANSI or UTF8 encoded, but not Unicode.

The following is an example of MyDlls.gac, which lists three files to install into the global assembly cache:

\Program Files\MyApp\MyDll1.Dll
\Program Files\MyApp\MyDll2.Dll
\Program Files\MyApp\MyDll3.Dll

The next time you run your application, the .NET Compact Framework moves the files into the global assembly cache. The files must be signed with strong names. Delay signing is not currently supported. Any changes to the .gac text file causes the following:

  • If you delete the .gac text file from the Windows directory, the files it listed will be removed from the global assembly cache the next time you run your application.

  • If you update the .gac text file, the .NET Compact Framework will update the files in the global assembly cache accordingly.

You cannot load assemblies by the same name. You must either change the names of the DLLs, or if the DLLs are strong named, place them in the global assembly cache and use the Load method with a full strong name.

See Also