Deploying .NET Assemblies

I thought I’d cover the intricacies of deploying .NET Dll’s in production and development environments today. One of a developers’ first tasks after creating an assembly is deciding the location to house their newly creating endeavour. The three main ways are

  1. Global Application Cache (GAC)
  2. Private Assemblies
  3. Codebase

Global Application Cache

Storing your assembly in the “Global Application Cache” (GAC) , allows your assemblies functionality to be utilized across several different applications. Once the assembly is in the GAC, the CLR (by default) will search this universal location for the applicable assembly.It is the first location the CLR will search for assemblies.

The location of the GAC is C:\Windows\Assemblies\GAC. There are a number of ways to deploy your assembly to the GAC. The main way is by calling the command line utility GACUtil.exe

Advantages:

  1. Shared between applications
  2. Eliminates dependency on relative/absolute path referencing correctness
  3. Small load performance boost (Load time strong naming verification not required as it’s a pre-requisite for GAC deployment)

Disadvantages

  1. Requires at least power user access control to deploy to GAC
  2. Requires assembly strong naming

Private Assemblies

The developer’s application directory is also know as the ApplicationBase, and is the private location where the CLR searches for assemblies.

Advantages

  1. XCopy deployment (copy application assemblies, config files to a single location for deployment)
  2. Flexible options in strong/weak naming and user installation access control

Disadvantages

  1. Cannot share private assemblies between applications

Codebase

This property allows the developer to specify a location to find an assembly (e.g. relative paths or web download). If the assembly is downloaded from the network then the assembly is copied and loaded from a location known as the download cache. Note that this location is not the same location as the GAC and hence does not provide the same capabilities such as assembly sharing.

Advantages

  1. Obtain the assemblies over the network
  2. Not restricted to ApplicationBase structure

Disadvantages

  1. Important to get correct directory in config file.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s