永久删除 NuGet 官方源
我的网络无法访问互联网
我设置了一个基于本地网络的源,一切都很好,除了更新选项卡总是显示以下警告
“无法解析远程名称:go.microsoft.com”
这很明显,因为我没有互联网连接,
如果我从 Nuget 提要源(在设置窗口中)中删除官方提要,
一切都会正常,直到我重新启动 Visual Studio,然后官方提要返回到源列表。
有没有办法从提要列表中永久删除官方提要?
我使用 Reflector 来查看幕后发生的事情,我发现 如果在尝试将 feed 源列表持久保存到磁盘时官方 feed 不存在,Nuget 将添加该官方 feed。
My network has no access to the internet
I setup a local web based feed and all is well, except that the update tab always shows me the following warning
"The remote name could not be resolved: go.microsoft.com"
This is obvious because I don't have internet connection,
If I remove the official feed from the Nuget feed sources (in the settings window)
everything works fine, until I restart Visual Studio and then the official feed comes back to the sources list.
Is there a way to permanently remove the official feed from the list of feeds?
I used reflector to see what is going on behind the scenes and I found out that the
Nuget adds the official feed if it is not present when trying to persist the list of feed sources to disk.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不确定这是否有帮助(我之前没有注意到这种行为),但是您是否尝试从 NuGet.config 中的“activePackageSources”元素中删除官方 NuGet feed 条目?
您可以在以下目录中找到它:%UserProfile*\AppData\Roaming\NuGet
编辑:请确保 nuget.config 文件确实定义了至少 1 个包源,否则它确实会回退到硬编码的官方 NuGet Feed URL。
问候,
泽维尔
Not sure if this helps (I didn't notice this behavior before), but did you try removing the official NuGet feed entry from the 'activePackageSources' element in the NuGet.config?
You can find it in the following directory: %UserProfile*\AppData\Roaming\NuGet
Edit: Please make sure the nuget.config file does define at least 1 package source, or it will indeed fall back to the hardcoded official NuGet feed URL.
Regards,
Xavier
您可以为
go.microsoft.com
添加一个本地主机文件(或 DNS)条目,该条目指向本地 Web 服务器,而该服务器又提供一个实际上为空的 feed 文件。有点老套,但这个技巧过去对我有用。
You could add a local hostfile (or DNS) entry for
go.microsoft.com
which points to a local web server, which in turn serves up an effectively empty feed file.A bit hacky, but this trick has worked for me in the past.