Connecting .NET applications in a multiple installation environment

By default, applications use the .NET assemblies from the primary installation. If there is no primary installation, or you do not want to use the primary installation assemblies, you must update the application configuration file, or the DEVPATH environment variable.

If there is a primary installation on the system, the .NET assemblies and policy files of that installation are registered to the global assembly cache (GAC). The .NET assemblies for all other installations can be found in the installation path of each installation, but the assemblies are not registered to the GAC. Therefore, by default, applications run using the .NET assemblies from the primary installation. You must update the application configuration file if any of the following cases are true:
  • You do not have a primary installation.
  • You do not want the application to use the primary installation assemblies.
  • The primary installation is a lower version of IBM® MQ than the version that the application was compiled with.
For information about how to update the application configuration file, see Connecting .NET applications using the application configuration file.
You must update the DEVPATH environment variable if the following case is true:
  • You want your application to use the assemblies from a non-primary installation, but the primary installation is at the same version as the non-primary installation.
For more information about how to update the DEVPATH variable, see Connecting .NET applications using DEVPATH.

Connecting .NET applications using the application configuration file

Within the application configuration file, you must set various tags to redirect applications to use assemblies that are not from the primary installation.

The following table shows the specific changes that need to be made to the application configuration file to allow .NET applications connect using particular assemblies:
Table 1. Configuring applications to use particular assemblies
  Applications compiled with an earlier version of IBM MQ Applications compiled with a later version of IBM MQ
To run an application with a later version IBM MQ primary installation. (later version assemblies in GAC): No changes necessary No changes necessary
To run an application with an earlier version IBM MQ primary installation. (earlier version assemblies in GAC): No changes necessary In the application configuration file:
  • Use the <bindingRedirect> tag to indicate the use of the earlier version of the assemblies that are in the GAC
To run an application with a later version of IBM MQ non-primary installation. (later version assemblies in installation folder): In the application configuration file:
  • Use the <codebase> tag to point to the location of the later version assemblies
  • Use the <bindingRedirect> tag to indicate the use of the later version assemblies
In the application configuration file:
  • Use the <codebase> tag to point to the location of the later version assemblies
To run an application with an earlier version of IBM MQ non-primary installation. (earlier version assemblies in installation folder): In the application configuration file:
  • Use the <codebase> tag to point to the location of the earlier version assemblies
  • Include the tag <publisherpolicy Apply=no>
In the application configuration file:
  • Use the <codebase> tag to point to the location of the earlier version assemblies
  • Use the <bindingRedirect> tag to indicate the use of the earlier version assemblies
  • Include the tag <publisherpolicy Apply=no>

A sample application configuration file NonPrimaryRedirect.config is shipped in the folder MQ_INSTALLATION_PATH\tools\dotnet\samples\base. This file can be modified with the IBM MQ installation path of any non-primary installation. The file can also be directly included in other configuration files using the <linkedConfiguration> tag. Samples are provided for nmqsget.exe.config and nmqsput.exe.config. Both samples use the <linkedConfiguration> tag and include the NonPrimaryRedirect.config file.

Connecting .NET applications using DEVPATH

You can find the assemblies using the DEVPATH environment variable. The assemblies specified by the DEVPATH variable are used in preference to any assemblies in the GAC. See the appropriate Microsoft documentation on DEVPATH for more information about when to use this variable.

To find the assemblies using the DEVPATH environment variable, you must set the DEVPATH variable to the folder that contains the assemblies you want to use. Then, you must then update the application configuration file and add the following runtime configuration information:

<configuration>
<runtime>
<developmentMode developerInstallation="true"/>
</runtime>
</configuration>