Using the stand-alone IBM MQ .NET client

The IBM® MQ .NET client offers you the ability to package and deploy an IBM MQ .NET assembly without needing to use the full IBM MQ client installation on production systems for running your applications.

Before you begin

[MQ 9.4.0 Jun 2024]From IBM MQ 9.4.0, the amqmdnetstd.dll client library installed in the default location is based on .NET 6.

[MQ 9.4.0 Jun 2024][MQ 9.4.0 Jun 2024]From IBM MQ 9.4.0, IBM MQ supports .NET 8 applications using IBM MQ classes for .NET. If you are using a .NET 6 application, you can run this application without any recompilation being required by making a small edit in the runtimeconfig file to set the targetframeworkversion to "net8.0".

[Removed][MQ 9.4.0 Jun 2024][MQ 9.4.0 Jun 2024]The IBM MQ .NET client library built using .NET Standard 2.0, which was deprecated at IBM MQ 9.3.1, has been removed from the product IBM MQ 9.4.0.

[Stabilized][Long Term Suppoort]The amqmdnet.dll library is still supplied, but this library is stabilized; that is, no new features will be introduced into it. For any of the latest features you must migrate to the amqmdnetstd.dll library. However, you can continue to use the amqmdnet.dll library on IBM MQ 9.1 Long Term Support or Continuous Delivery releases.

About this task

You can build your IBM MQ .NET applications on a machine where the full IBM MQ client is installed and later package the IBM MQ .NET assembly, that is, amqmdnetstd.dll, along with your application and deploy it on production systems.

The applications that you build and deploy can be the traditional .NET applications, Services, or Microsoft Azure Web/Worker applications

In such deployments, the IBM MQ .NET client supports only the managed mode of connectivity to a queue manager. The server bindings and unmanaged client mode connectivity are not available as these two modes require a full IBM MQ client installation. Any attempt to use these other two modes results in an application exception.

Procedure

Referencing the IBM MQ .NET client assembly in applications

  • Reference the amqmdnetstd.dll assembly in your application in the same way that you did for earlier releases.
    Set the CopyLocal property of the amqmdnetstd.dll assembly to True to ensure that the amqmdnetstd.dll assembly is copied to the bin directory of the application. Setting this property also helps the application packaging tool to package the required binary files for deployment on production systems as well as Microsoft Azure PaaS cloud environments.

Adding global transaction support

  • Ensure that your application deploys the monitor application WMQDotnetXAMonitor on the machine along with the application itself.
    If an application uses the IBM MQ .NET managed global transaction feature, then it must also deploy the WMQDotnetXAMonitor on the machine along with the application itself. This utility is needed for recovering any in-doubt transactions.

Starting and stopping trace

  • For IBM MQ classes for .NET Framework only, to start and stop trace using the application configuration file and an IBM MQ specific trace configuration file, see Tracing an IBM MQ classes for .NET Framework client using an application configuration file.

    You must use the application configuration file and an IBM MQ specific trace configuration file because, since there is no full IBM MQ client installation, the standard tools that are used for starting and stopping trace, strmqtrc and endmqtrc, are not available.

    Notes:
  • [MQ 9.4.0 Jun 2024]Start and stop trace by using the mqclient.ini file and setting the appropriate properties of the Trace stanza.
    See Tracing IBM MQ .NET applications with mqclient.ini.

    From IBM MQ 9.4.0, you can configure trace by using the mqclient.ini file and setting the appropriate properties of the Trace stanza. You can also enable and disable tracing dynamically with the mqclient.ini file.

Enabling binding redirection in the application configuration file

  • To enable compile time binding reference of the IBM MQ .NET assembly to a later version of the assembly, add the <dependentAssembly> property to the application configuration file.
    The following example snippet in the app.config file redirects an application that was compiled using the IBM MQ 8.0.0 Fix Pack 2 (8.0.0.2) version of the IBM MQ .NET assembly but later a fix pack, IBM MQ 8.0.0 Fix Pack 3, was then applied that updated IBM MQ.NET assembly to 8.0.0.3.
    <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <!-- amqmdnet related binding redirect -->
        <dependentAssembly>
          <assemblyIdentity name="amqmdnet"
                             publicKeyToken="dd3cb1c9aae9ec97"
                             culture="neutral" />
          <codeBase version="8.0.0.2"
                href="file:///amqmdnet.dll"/>
          <bindingRedirect oldVersion="1.0.0.3-8.0.0.2"
                           newVersion="8.0.0.3"/>
          <publisherPolicy apply="no" />
        </dependentAssembly>
      </assemblyBinding>
    </runtime>