Home: Missing nuget.org source after updating to NuGet 3.4.1

Created on 4 Apr 2016  路  6Comments  路  Source: NuGet/Home

I could not determine if this problem is related to #2429, because in my case it is the behavior of VS which was changed.

Since I installed VS 2015 Update 2 (I have juste tried to add a new package today), the Package Source is stuck in "Microsoft and .NET" source, and no other sources are available: the officiel nuget.org source was gone.

My %appdata%\nuget\nuget.config was this (never edited by hand, never customized in VS):

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <activePackageSource>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
  </activePackageSource>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
</configuration>

In visual studio Options screen, the available package sources was empty.

What seems strange is that nuget sources list in the console was still displaying nuget.org as enabled:

C:\Users\Thomas\.nuget\bin>nuget sources list
Registered Sources:
  1.  nuget.org [Enabled]
  https://api.nuget.org/v3/index.json

Plus, in the Options UI, the "+" and "Delete" buttons are grayed as soon as I click on the machine-wide package. Even when I deselect the Microsoft and .NET package source the buttons remains grayed. The only solution to allow the "+" button to be available again is to restart visual studio then go to the options screen, then press "+" without clicking anywhere in the listboxes.

As a workaround, you can delete the nuget.config in %appdata%nugetnuget.config. The next time you restart VS, nuget will generate a default configuration file. note that this delete any custom configuration. (source: nuget FAQ)

My config is now:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

And now I can choose "All" (or nuget.org) as a package source when searching in nuget ui.

I do not know exactly the origin of the problem, but it seems to be related to VS 2015 update 2, or something similar, because of the timing.

1 VS.Client Bug

Most helpful comment

@IldarDev As explained in my issue, you can delete %appdata%\nuget\nuget.config then restart VS: the default source should be back.

Note also that based on his screenshot, it seems that VS 2015 update 2 is not the culprit. Perhaps NuGet 3.4.1 ?

All 6 comments

I have the same problem!

  • 1
    123

Please, help! I can't go on work on my project without nuget.org source.

@IldarDev As explained in my issue, you can delete %appdata%\nuget\nuget.config then restart VS: the default source should be back.

Note also that based on his screenshot, it seems that VS 2015 update 2 is not the culprit. Perhaps NuGet 3.4.1 ?

It's works! Thx bro!

Maybe, it problem of 3.4.1 version. I have updated to latest version yesterday.

@tbolon the issue here is not in 3.4, it's in 3.3, 3.3 will create an empty config file on your machine just like what you post here, but because we forced user to have nuget.org from nuget code in 3.3, then user can't hit this issue. but in 3.4, this issue is fixed and we will not force user to have nuget.org and respect what user have in config file, then you hit this issue. so if you have old config file on your machine, you need to delete it and 3.4 will create a right one for you. And For Plus button bug, the fix for that is in PR, 3.4.2 will have the fix. Sorry for the inconvenience.

we will provide a fix in 3.4.2 to add nuget.org to empty config file.

Was this page helpful?
0 / 5 - 0 ratings