Preparation and Versioning
When you compile the installed version of the Enterprise Library 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.
Using XCopy
You are not required to use strong names or to install the Enterprise Library in the GAC. You can compile and deploy the application blocks—without modifying them—in the directory structure of any application that uses the Enterprise Library. 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 Enterprise Library application blocks, you must install a copy of the assemblies in each application's folder hierarchy.
Using the Global Assembly Cache
Alternatively, you can sign the Enterprise Library 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 Enterprise Library assemblies in a shared location and multiple applications can use them. For example, you could deploy Enterprise Library application block assemblies in the global assembly cache. If you do this, all applications on the computer can use the Enterprise Library. To learn how to strong name an Enterprise Library assembly, see Strong Naming the Enterprise Library Assemblies.
If you decide to locate the assemblies in the global assembly cache, there are some extra steps you must take if you use the Data Access Application Block and the Validation Application Block. These blocks use special registration providers to load the providers they use. Therefore, you must either:
- Copy these assemblies into your local application run-time folder by setting the Copy Local property for the assembly in Solution Explorer to True.
- Implement additional configuration settings to allow Enterprise Library to load the providers from the global assembly cache. For more information about these settings, see https://entlib.codeplex.com/WorkItem/View.aspx?WorkItemId=26903.
Installing an Assembly in the Global Assembly Cache
You can use one of the following tools to install an assembly in the GAC:
- An installer program, such as the Microsoft Windows Installer
- 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.
Versioning
All application block assemblies 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.
It is not recommended that you use the Enterprise Library 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.
The Enterprise Library 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.