Package management has always been a pain in the .NET world. Developers must manually download the package from the vendors website and add a reference to their application. This can become a big headache if you are downloading multiple packages from different vendors. In this article we are going to introduce the NU framework which is inspired by the bundler framework in Ruby.

Ruby Package Management:

Ruby package management is much mature than .NET. Ruby uses RubyGems to download and install the packages. It even manages the dependencies between the packages. The following implementation shows how to install the rails gem using Ruby.



The above code not only installs the rails framework but also install all the dependencies of rails. This makes it easy for developers to quickly install the packages and setup their environment. The closest thing Microsoft achieved similar to this was gems in IronRuby but that was fairly limited. Unfortunately, the IronRuby is now no longer supported by Microsoft. Although we hope that the open source community pick it up and continue the developement of the IronRuby framework. In the meantime NU project rescues .NET developers from package management nightmares. In the next section we will demonstrate how to use NU.

Using NU:

The first step is to install NU on your machine. The NU is a Ruby gem so in order to download NU you must have Ruby installed on your machine. Use the link below to download and install Ruby on your machine:

Download Ruby

After installing Ruby you can go to the command prompt and type the following command:



This will install the NU gem on your machine. Now you are ready to download packages. Go to your project folder and type the following:



The screenshot below shows the nu gem in action:



By default NU creates a new folder called lib and download the packages in the lib folder. The screenshot below shows the content inside the lib folder.


 
The screenshot shows that not only nhibernate was downloaded but all of its dependencies were also downloaded. This is the magic of RubyGems which enabled us to download the package along with its dependencies. If you want to put the packages in a folder different than "lib" then you can use the following arguments with the NU gem.



Using NU Extension for Visual Studio 2010:

There is also an NU extension for Visual Studio 2010 which allows you to add the reference to the assembly from within Visual Studio. The NU extension can be downloaded using the following URL:

http://github.com/kiliman/NuForVS/downloads

To install the extension simply double click on the file and it will be installed on your machine. Restart your Visual Studio 2010 and the extension will be enabled. To use the extension right click on the project and click on "Add NU Reference". This will open a window where you can add the required gem. The screenshot below shows the NU extension in action.



Conclusion:

Package management in .NET was also very cumbersome and had to be performed manually. NU project brings the easiness and simplicity to the .NET world. Hopefully, the .NET community will invest in this idea and embrace the NU project.