Adding Package Source In Visual Studio 2015

In Visual Studio 2015, we can add multiple package sources to get data for Nuget Package Manager. Let me explain first why we need to add a package source for Nuget package manager.

I downloaded an ISO file of Visual Studio 2015 with update 2 and installed it and created a project, then I was trying to download Dapper ORM from Nuget Package manager but I was unable to download it because in the package source dropdown list there was only one option and that was Microsoft & .NET which was getting data from the URL and I did not find the required package from this URL.

I am not sure why Visual Studio Update 2 ISO file does not include the name “” with URL whereas I downloaded Visual Studio 2015 on another machine 6-7 months ago and upgraded it to update 1 and later on update 2 and in that machine I am able to search Nuget package because it contains 3 sources:

    a. and .NET&

  2. Microsoft Visual Studio Offline Packages : C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
So if you are missing a package manger or you want to add some custom package manager you can do it easily. To add a new package manger do the following things:
  1. Open Nuget Package Manager Package Source Setting Window. There are different ways to open “Nuget Package Manager Package Source Setting”.

    a. Way 1:
    Open Solution Explorer, Select & right click on your Project, then Choose “Mange NuGet Packages…” from context menu, It will open NuGet Package Manger window.

    Way 2: Go to “Tools” menu => Options… => on Left Menu Tab select “Nuget Package Manager” => “Package Sources”,

Currently I have added 3 Sources out of which 2 were under Machine-wide package section and 1 under Available package sources section. Now I am going to add some more package sources. We can add any URL as package source but if it is not valid then at the time of searching the package it will give error and will not be able to search the desired package.

Adding a package Source

To add a package source do the following do the following things…

Click on Add >> Type Name and Source >>Update >> OK

I am adding 2 sources out of which 1 is correct source whereas 2nd one is incorrect.
  1. Correct Source: with name NugetV1 &
  2. Incorrect Source: with name ABC

But when you will search for a package and it have incorrect source then it will not search any packages and gives an error.

So, remove the incorrect URL from the list or modify the Package with correct URL.

Adding Offline Packages

We can also add offline package sources in it to do that follow the below steps:
  1. Go to the URL.
  2. Login/Register for the website
  3. Go to the Packages Tab
  4. Search for any package e.g. I searched for “Dapper dot net”.
  5. Click on Download link to download it. It will provide a .nupkg file to download.
  6. Save it to your hard disk.
  7. Now open the add package source window from where were can add package source.
  8. Click on Add button to add it.
  9. Give the name “MyLocalPackageSource” and browse your hard drive for physical path.

As you can see in the above image I have selected the physical path “D:\OfflineNUgetPackages\VS2015” you can store it anywhere. But one of the most interesting point about Visual Studio 2015 is that it already Having a path of Offline Packages which is by default stored at “C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\” you can find it inside the Machine-wide package section. You can install any number of package inside this folder on local drive but you cannot modify the path for “Machine-wide packages”.

I have browsed the path and you can see that at this path it’s already having 332 folders which contain different version of packages having 475 *.nupkg files. This number may differ as per your uses version and other constraints. After adding all these package sources you can choose any one of them from drop down list as show in the below screen shot.

The same settings also applies for Visual Studio 2016. If you want to learn more about Visual Studio 2016 you can go through the article

Similar Articles