Use the IBM MQ .NET project template
The IBM MQ .NET client offers you the ability to use a project template to assist you in developing your .NET Core applications.
Before starting
We must have Microsoft Visual Studio 2017, or later, and .NET Core Version 2.1 on the system.
We 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 our installation
- &USER_HOME_DIRECTORY is your home directory.
We must stop and restart Microsoft Visual Studio to pick up the template.
About this task
The .NET project template includes some common code used to help develop the applications. With the in-built code, we 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
- Open Microsoft Visual Studio.
- Click on File, followed by New and then Project.
- In the Create a new project window, select IBM MQ .NET Client App (.NET Core) and click Next.
- In the Configure your new project window, change the Project
name of our project if we 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 we can modify these properties accordingly.
- Compile and run the application.
Parent topic: Writing and deploying IBM MQ .NET programs
Related information