Quickly add a reference to a NuGet packages in Visual Studio 2015

Quickly add a reference to a NuGet packages in Visual Studio 2015

With the recent updates of Visual Studio 2015 (Update 3 RC),  we can now install and add references for Nuget Packages as part of quick fix light bulb.  Like wise, adding references from installed assemblies, Visual Studio now also suggests Nuget Packages for references for the specific types. Then you can install  and refer the latest version automatically or take help of package manager to install specific versions for the same Nuget Package.

Consider an example of using JSON.NET in your application, where either we do install the packages from Package Manager, Package Manager Console. Now, with the Visual Studio updates,  the yellow light blub also suggests for quick fix to add and install Newtonsoft.Json nuget package.

Quickly add a reference to a NuGet packages in Visual Studio 2015

You can select “Find and Install latest version” which will install the Nuget references in solution explorer, also refer the same in the file.

Quickly add a reference to a NuGet packages in Visual Studio 2015

 

In case you select “Install with Package Manager”, Visual Studio will open the Package Manager with Newtoksoft.Json as search item. Here you can select specific versions to install.

Quickly add a reference to a NuGet packages in Visual Studio 2015

 

Related Post : How to Install a local sources NuGet package or a Prerelease package in Visual Studio 2015 ?

 

You can enable this features from Tools –> Options dialog windows.

Navigate to C# Languages option and from Advanced Tab, select “Suggest usings for types in Nuget packages

Suggest usings for types in Nuget packages

Hope this helps !

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

4 Comments to “Quickly add a reference to a NuGet packages in Visual Studio 2015”

Comments are closed.