Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Official" Way to deploy Assemblies into the GAC?

I just wonder - if I need to deploy an assembly into the GAC, what is the "official" way of doing it?

Currently we either manually drag/drop into the c:\windows\assembly folder or we use gacutil.exe. The first way is obviously not the good one (it's manual process after all), and gacutil is part of the SDK and not available per default on production servers.

Are there any Microsoft deployment Guidelines?

like image 830
Michael Stum Avatar asked Jun 09 '09 08:06

Michael Stum


People also ask

What is GAC deployment?

Installing application components into the the Global Assembly Cache (GAC) can be useful if you are installing components that will be used by multiple applications on the same machine, or if you need to run multiple versions of the same assembly on a single computer.

How do I add and remove assembly from GAC?

There are two ways to remove an assembly from the global assembly cache (GAC): By using the Global Assembly Cache tool (Gacutil.exe). You can use this option to uninstall assemblies that you've placed in the GAC during development and testing. By using Windows Installer.


2 Answers

The simplest way by far is using a Setup project. There, you can just add assemblies from your project output(s) into a special GAC folder, and the installer will add them to the GAC for you.

like image 50
Tor Haugen Avatar answered Sep 26 '22 05:09

Tor Haugen


If you're not using an existing installer technology, the "official" way is through the IAssemblyCache::InstallAssembly native API. But a managed alternative can be found in the System.EnterpriseServices.Internal namespace. Despite the name, it is in fact a public class in a standard assembly.

Publish.GacInstall

like image 39
Josh Avatar answered Sep 22 '22 05:09

Josh