Monday, September 17, 2012

C# ZeroMQ Install Step by Step for Visual Studio.

ZeroMQ is a socket library that has many uses and claims to be faster than TCP for clustered products and supercomputing. Sounds interesting! In attempting to install ZeroMQ for C# in Visual Studio, I found that the documentation was not very clear, and nowhere could I find a step by step guide for installing C# ZeroMQ.

This post is made so I can recall the ZeroMQ C# installation steps for future reference, and in hopes that someone else might have an easier path to ZeroMQ installation in Visual Studio.

The easiest way to get ZeroMQ working for C# is by using a Visual Studio Extension called NuGet. To download NuGet from within Visual Studio, use the Tools / Extension Manager menus.

From within Visual Studio's Extension Manager, click on Updates and wait for the list to populate. Select NuGet Package Manager, and wait for the package to download and install.

To display the NuGet Package Manager select View / Other Windows / Package Manager Console from the menus. Make sure your Visual Studio project is set to either x64 or x86 from the Project / Properties menu in Visual Studio, then install the appropriate package from the link above

The installation package for ZeroMQ is clrzmq 2.2.5 or clrzmq-x64 for x86 or x64 projects respectively.

In Visual Studio's Project Manager Console type one of the following in:

PM> Install-Package clrzmq -Version 2.2.5
PM> Install-Package clrzmq-x64

This command will install the appropriate version in your package. I created an x64 project with the command directly above. This created a new directory under my project.

Open up Windows Explorer and find your project's folder. You should see a new subfolder called packages\clrzmq-x64.2.2.5\content that contains the libzmq.dll library if you are doing an x64 project.

Copy libzmq.dll to your \bin\Debug or \bin\Release directory so that your project can find the dll.

Prepare one of the sample codes that are available on github for C#.

For your next project you will need to once again use the Package Manager Console to build the libzmq.dll and create the clrzmq and clrzmq-ext References in C#, so make a note of the installation command and file copying procedure for future reference:

PM> Install-Package clrzmq -Version 2.2.5
PM> Install-Package clrzmq-x64

As a post script, the ZeroMQ Windows installation doesn't seem to be necessary for C# users. In fact, I uninstalled it and was still able to run my demo project. The installation contains some executables and dlls, as well as a number of help documents that may be of interest to developers.


Petra Kralj said...

I use Visual Studio 10.

Extension Manager --> Online Gallery
instead of
Extension Manager --> Updates

Petra Kralj said...
This comment has been removed by the author.
Patrick White said...

Thanks for that clarification Petra!