Building the Enterprise Library

Retired Content

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.

Although the Enterprise Library includes binaries for all the source code, you may want to customize the source code. This means you will need to build the Enterprise Library yourself. The following sections describe how to do this. After you have the binaries, you may want to strong-name them. For more information about this topic, see Strong-Naming the Enterprise Library Assemblies.

Installing the Source Code

You can install all the Enterprise Library source code using the Source Code Installer. When you run the installer, you can choose to install one or all of the following items: application blocks, Application Block Software Factory, Strong Naming Guidance Package, and the QuickStarts.

To run the Source Code Installer

  1. Click Start, point to Programs, point to Microsoft patterns & practices, and then click Enterprise Library 3.1 – May 2007.
  2. Choose Enterprise Library Source Code Installer, and then follow the instructions.

Enterprise Library Visual Studio Solution Files

The Enterprise Library source code contains several Visual Studio projects. The Enterprise Library includes multiple Visual Studio 2005 solution files. Three of the solution files contain projects for the Enterprise Library Core and all the application blocks, minus certain projects that have non-standard dependencies (see Table 1). You can use these solution files to build the entire Enterprise Library or to create solution files that contain only the projects you want to build. When you build the Enterprise Library, the core and configuration console are built automatically.

Table 1: Solution Files

Configuration

Description

EnterpriseLibrary.sln

Contains the entire set of application block projects, Enterprise Library Core projects, and the configuration console. Does not include the unit test projects.

EnterpriseLibrary.VSTS.sln

Contains the entire set of application block projects, Enterprise Library Core projects, and the configuration console. Includes all unit tests for execution with Visual Studio Team System.

EnterpriseLibrary.Nunit.sln

Contains the entire set of application block projects, Enterprise Library Core projects, and the configuration console. Includes all unit tests for execution with NUnit. Solution files containing source code for strong-named assemblies, and the Application Block Factory, are also included.

In addition, there are two solution files for each application block. One solution file includes NUnit unit tests; the other solution file includes Visual Studio Team System (VSTS) unit tests. These application block solution files contain all the projects, including the provider projects, for the application block. They also contain the configuration design-time projects. The configuration design-time assemblies are required for executing the configuration console, but they are not required for deploying or executing applications.

For more information, see The Enterprise Library Configuration Console.

Note

Similarly, the Enterprise Library solution files do not contain the following run-time projects and design-time projects: ExceptionHandling.WCF Validation.Integration.WCF Data.SqlCe These projects can be found in their respective solution files.

Build Configurations

The Enterprise Library solution files include two build configurations: Release and Debug. All projects within a solution file, including the unit test projects, are compiled in both configurations.

Building the Enterprise Library Application Blocks and Tools

There are two ways to build the Enterprise Library application blocks and tools. You can use either batch files or Visual Studio solution files.

Building the Enterprise Library Using Batch Files

When you install the Enterprise Library source code, the installation program creates a menu item labeled Build Enterprise Library on the Start menu. You click this menu item to compile a Debug version of the application blocks and tools. There are also batch files to build the Enterprise Library and copy the resulting assemblies to the appropriate location. These batch files are installed in the src subdirectory of your Enterprise Library installation directory.

The batch files are the following:

  • BuildLibrary.bat. This compiles all application blocks and tools. When launched with no parameters, it builds a Debug version of the application blocks and tools. It accepts one parameter to indicate an alternative build type, such as a Release build.
  • CopyAssemblies.bat. This copies the assemblies to the bin directory. When launched with no parameters, it copies the Debug assemblies to the INSTALLDIR\Program Files\Microsoft Enterprise Library\bin directory. It accepts two parameters. The first parameter indicates an alternative build type, and the second parameter indicates the destination directory where the assemblies will be copied.
  • BuildLIbraryAndCopyAssemblies.bat. This sequentially executes BuildLibrary.bat and CopyAssemblies.bat.

Building the Enterprise Library Using Visual Studio Solution Files

You can also use Visual Studio to compile the Enterprise Library application blocks and tools. In Visual Studio .NET 2005, open the EnterpriseLibrary.VSTS.sln or EnterpriseLibrary.Nunit.sln solution file. On the Build menu, click Build Solution. The solution files include the entire set of projects for the application blocks, optional providers, common assemblies, and tools.

The solution files do not copy the assemblies to the bin directory. You can run CopyAssemblies.bat to copy the assemblies to the bin directory. The Start menu item labeled Copy assemblies to bin folder launches this batch file.

Note

To install the instrumentation schema, you can either run the InstallServices.bat batch file or you can use the Install Instrumentation shortcut on the Start menu. To use the shortcut, click Start, point to All Programs, point to Microsoft patterns & practices, point to Enterprise Library 3.1 – May 2007, and then click Install Instrumentation.

Usage Notes

These are some additional points about building the Enterprise Library:

  • The Configuration Console requires the application block assemblies to be located in the same directory as the configuration console executable (EntLibConfig.exe). It requires both the run-time assemblies and the design-time assemblies. Each application packages the design-time support in assemblies that are separate from the run-time implementation. These assemblies are not required for running an application that uses the application blocks. However, they are required when you use the configuration console to change the application block's configuration. All the required assemblies have the suffix .configuration.design.dll. Use the CopyAssemblies batch file to place the assemblies into the bin directory.
  • The Enterprise Library Configuration Console saves fully qualified type information in the application configuration files. When you use the Enterprise Library Configuration Console with unsigned versions of the application blocks, the PublicKeyToken value for fully qualified types will be null. If you rebuild the application blocks and sign the assemblies, you will have to update the existing application configuration files to incorporate the correct PublicKeyToken value. If you fail to do this, your applications could use incorrect versions of application block assemblies. You can update the configuration files by using the configuration console to open and save them. The configuration console uses signed versions of the application blocks. Alternatively, you can manually edit the configuration files and update the value of the PublicKeyToken.
  • The Security Application Block includes an authorization provider for Authorization Manager (AzMan). This provider requires AzMan to be installed and also requires the interop assembly, Microsoft.Interop.Security.AzRoles.dll. If you do not have AzMan installed locally with the interop assembly, you will see an error message when you build the Security Application Block solution files. The error message indicates that the type or namespace name "Interop" does not exist in the class or namespace "Microsoft." This error is expected when AzMan is not installed, and you can ignore it. The Security Application Block will build successfully, but the AzMan provider will not be available.
  • The Enterprise Library solution files do not contain the following run-time projects and design-time projects:
    • ExceptionHandling.WCF

    • Validation.Integration.WCF

    • Data.SqlCe

      These projects can be found in their respective solution files.

Building the QuickStarts

The QuickStart projects are not included in the Enterprise Library solution files. Each QuickStart has a solution file that includes the QuickStart projects and all required application block projects. To build a QuickStart, open the specific QuickStart solution file in Visual Studio .NET 2005, and then click Build Solution on the Build menu.

Retired Content

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.