Visual Studio, Nuget package sources, Order doesn't stick

Visual Studio, Nuget package sources, Order doesn't stick

 

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.

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(62)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2019-03-21 cat查看文件以及sed查看指定行数
2019-03-21 sql server database mail
2019-03-21 X-Pack for the Elastic Stack [6.2] » Securing the Elastic Stack »Setting Up User Authentication
2018-03-21 wox 快速搜索程序
2018-03-21 QTTabBar http://qttabbar.wikidot.com/
2018-03-21 git出错调试
2018-03-21 虚拟机无法上网的问题的解决
点击右上角即可分享
微信分享提示