Deployment and Operations
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
|The latest Enterprise Library information can be found at the Enterprise Library site.|
When you use the Unity Application Block in your applications, you must deploy the required assemblies with your application or install the assemblies on the target computer in the global assembly cache. You must include the following assemblies with your application:
- The Unity assembly named Microsoft.Practices.Unity.dll
- The ObjectBuilder version 2 assembly named Microsoft.Practices.ObjectBuilder2.dll
You can deploy an application that uses the Unity Application Block in one of two configurations:
- As private assemblies in the application folder hierarchy
- As shared assemblies in any file system location or in the global assembly cache
For advice on updating existing versions of the Unity Application Block assemblies, see Updating the Unity Assemblies.
When you compile the installed version of the Unity Application Block source code, the assemblies produced will not be strong named. As a result, they cannot be installed in the global assembly cache, nor will they have the other benefits associated with strong-named assemblies. To learn how to strong name the Unity Application Block assemblies, see Strong Naming the Unity Assemblies.
You are not required to use strong names or to install the Unity Application Block assemblies in the global assembly cache. You can compile and deploy the application block—without modifying it—in the directory structure of any application that uses the Unity Application Block. This simplifies deployment because you can use the xcopy command to install the entire application, including the application block assemblies, on the target computer. However, if multiple applications on the same computer use the Unity Application Block, you must install a copy of the assemblies in each application's folder hierarchy.
Using the Global Assembly Cache
Alternatively, you can sign the Unity Application Block assemblies with a strong name key. This will ensure that their names are globally unique and will also provide versioning. If you take this additional step, you can deploy the Unity Application Block assemblies in a shared location and multiple applications can use them. For example, you could deploy the Unity Application Block application block assemblies in the global assembly cache. If you do this, all applications on the computer can use the application block. To learn how to strong name the Unity Application Block assemblies, see Strong Naming the Unity Assemblies.
Installing an Assembly in the Global Assembly Cache
You can use one of the following tools to install an assembly in the global assembly cache:
- An installer program, such as the Microsoft Windows Installer version 2.0
- The Global Assembly Cache tool command line utility (Gacutil.exe)
- The .NET Framework Configuration tool (Mscorcfg.msc)
For more information about deploying .NET applications, see Deploying .NET Framework-based Applications on MSDN.
All the assemblies provided with the Unity Application Block are strong named, which provides versioning and naming protection. This means that the name of the binary code is guaranteed to be unique and that the versions being loaded are the ones intended to be used with the application. Because the application block assemblies are strong named, you can install them in the global assembly cache, where they can be shared by multiple applications on the computer.
The Unity Application Block installation package includes compiled assemblies for the application blocks. It also includes the source code for the application blocks and scripts that you can run to create the complied assemblies. The assemblies you create this way are not strong named. To sign an assembly with a strong name, you must have a public/private key pair. For more information, see Strong-Named Assemblies and Versioning Tutorial.
It is not recommended that you use the Unity Application Block namespaces because it makes it difficult to identify the source of the code. Instead, you should choose a root namespace that meets your own coding and versioning standards.