[V9.1.5 Apr 2020][Windows]

Using the IBM MQ .NET project template

From IBM® MQ 9.1.5, the IBM MQ .NET client offers you the ability to use a project template to assist you in developing your .NET Core applications.

Before you begin

You must have Microsoft Visual Studio 2017, or later, and .NET Core 2.1 on your system.

You must copy the .NET template from the
&MQ_INSTALL_ROOT&\tools\dotnet\samples\cs\core\base\ProjectTemplates\IBMMQ.NETClientApp.zip
directory to the
&USER_HOME_DIRECTORY&\Documents\&Visual_Studio_Version&\Templates\ProjectTemplates
directory, where:
  • &MQ_INSTALL_ROOT is the root directory of your installation
  • &USER_HOME_DIRECTORY is your home directory.

You must stop and restart Microsoft Visual Studio to pick up the template.

About this task

The .NET project template includes some common code that you can use to help develop your applications. With the in-built code, you can connect to the IBM MQ queue manager, and perform a put or a get operation by simply modifying the properties in the in-built code.

Procedure

  1. Open Microsoft Visual Studio.
  2. Click on File, followed by New and then Project.
  3. In the Create a new project window, select IBM MQ .NET Client App (.NET Core) and click Next.
  4. In the Configure your new project window, change the Project name of your project if you want to, and click Create to create the .NET project.
    MQDotnetApp.cs is the file that is created along with the project file. This file contains the code which connects to the queue manager, and performs a put and get operation.
    The connection properties are set to default values:
    • MQC.CONNECTION_NAME_PROPERTY is set to localhost(1414)
    • MQC.CHANNEL_PROPERTY is set to DOTNET.SVRCONN
    The queue is set to Q1, and you can modify these properties accordingly.
  5. Compile and run the application.