With the help of this post, we will be learning about adding references to projects using NuGet packages in Visual Studio.
NuGet is a free and open-source package manager, inspired from the most efficient features available in the Linux EMACS software, designed for the Microsoft development platform (formerly known as NuPack).
Since its introduction in 2010, NuGet has evolved into a larger ecosystem of tools and services.How to add references using in Visual Studio using NuGet? #visualstudio #nuget Click To Tweet
Benefits of using NuGet
- NuGet is smart enough to add assembly binding redirects when required
- Dependencies of a package are automatically resolved
- It notifies you about available package updates
- Creating packages makes people think about component architecture (all dependencies should be packaged as well)
- You can get rid of binaries bloating your VCS repositories (package restore feature)
I am sure there are many more advantages of using NuGet packages. If you think of any other apart from those listed above, feel free to list them in comments section right below the post.
Steps for adding DLLs or assemblies in project using NuGet:
Step 1 – Go to Projects Menu and Select Manage NuGet Packages as shown below:
Step 2 – Search for the reference or DLL which you want to add by typing into search box. Once you find appropriate reference to add, click on Install button.
Step 3 – After the installation, you will be able to see that visual studio have added a folder named “.nuget” in your solution explorer.
Step 4 – For adding references, Navigate to Packages folder in your solution and choose the appropriate DLL.
This is all about adding references using NuGet in Visual Studio. Feel free to comment, if you face any issues.
Hope you enjoyed this post.
What do you think?
Your questions or suggestions are always welcome. Feel free to email us or put your thoughts as comments below. In addition to that, if you found this post useful then please share along with your friends and help them to learn.