Skip to content

Working with NuGet Package Manager

NuGet is a visual studio extension which makes it easy to install and update open source libraries in visual studio. One can simply search for the library which needs to be added to the solution. The rest of the work i.e adding references, finding dependency etc. are all done by NuGet. It automatically updates your solution and library with the new libraries.

Download NuGet from here.

Steps to add an open source library from NuGet

Once the installation is done, fire up your visual studio and start a new project. for example, we have created a new web application. whose structure looks like the below screen.

image

Now, right click the project in which you want to add a library. Here we will be adding a library to our BusinessLibrary project. when you right click you will see the following pop up screen.

image

Select manage NuGet package from the list. after selection one more screen popups.

image

Click on the Online tab at the left hand side and Type in the search box to search your open source library which you want to add. for example, we will be adding Enterprise library logging library to our bussinesslibrary project.

image

You can see the list of libraries available from the search term enterprise. next we click on the install button for the library to be installed.

image

NuGet automatically resolves the dependency and adds references to all the libraries required to support the library chosen.

Once the installation is complete. You can see the details of the library added in the references.

image

Here, we have successfully added Microsoft Enterprise logging library and all the dependency libraries. Happy coding….

Published inMicrosoft .NETNuGet
LinkedIn
Share
WhatsApp