for our work, we have three local nuget repos along with nuget.org and M$. I tried to reorder them like this:
but when I saved that, then opened the settings again, my new order was gone:
What am I doing wrong?
So this is indeed a bug in the VS 2017 and VS 2019 UI, in that it sometimes (often?) can't save your chosen order. I poked around a bit, having been bitten by the same bug today myself, and the good news is that you can fix the package order yourself, outside of Visual Studio, because it's just stored in a text file on disk.
Close Visual Studio, and then go into C:\Users\[your name]\AppData\Roaming\NuGet\
, and you'll find a NuGet.Config
file that contains XML that looks something like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
<add key="My Local Packages" value="C:\Code\NugetPackages" />
...
</packageSources>
...
</configuration>
Notice that those <add ... />
elements exactly match what you see in the Nuget Package Manager UI, in the same order. So you can manually reorder the <add ... />
elements in this file to whatever order you want your package sources in, and save it; and both Nuget and Visual Studio will respect the new order you've chosen.
I can reproduced this issue in the VS 2017 latest version and have already reported this issue to the VS Product Team, please check this: Tools-Options-NuGet Package Manager-Package Sources: the order of the available package sources not saved and you can add a comment to follow the response comes from the product team engineer, thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With