Visual studio Can';无法摆脱NuGet官方软件包源

Visual studio Can';无法摆脱NuGet官方软件包源,visual-studio,nuget,Visual Studio,Nuget,我进入packagemanager->packagesources选项并删除NuGet官方包源,这样就只有我的本地源可用。然后我关闭VisualStudio2010。一旦我重新打开VisualStudio,NuGet官方包源代码仍然位于可用包源代码的顶部 我尝试了导出和导入设置,删除了相关的suo文件,但没有效果。即使我没有打开解决方案,也会发生这种情况 我发现,当我第二次打开VS时,下面的配置文件是正确的。C:\Documents and Settings{myusername}\Applic

我进入packagemanager->packagesources选项并删除NuGet官方包源,这样就只有我的本地源可用。然后我关闭VisualStudio2010。一旦我重新打开VisualStudio,NuGet官方包源代码仍然位于可用包源代码的顶部

我尝试了导出和导入设置,删除了相关的suo文件,但没有效果。即使我没有打开解决方案,也会发生这种情况

我发现,当我第二次打开VS时,下面的配置文件是正确的。C:\Documents and Settings{myusername}\Application Data\NuGet\NuGet.Config

一旦我在工具->选项下打开包管理器,官方源代码就会添加到NuGet.Config中

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="Local Package Source" 
        value="http://nuget:8081/DataServices/Packages.svc/" />
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
</configuration

“我认为这可能是AddOfficialPackageSourceIfNeeded()在这里实现的一个问题”。。。

NuGet vsix本身中有一些代码,如果列表中没有其他代码,则会添加默认反馈,但其中似乎有一个bug:

    if (officialFeed == null)
    {
        // There is no official feed currently registered

        // Don't register our feed unless the list is empty (other than the aggregate). This is the first-run scenario.
        // It also applies if user deletes all their feeds, in which case bringing back the official feed makes sense.
        if (_packageSources.Count > 1)
        {
            return;
        }

    }
然后,这就完成了,并添加了官方提要作为第一个源。我会添加另一个源,这样您就有>1个源(本地目录应该可以工作)。这应该可以防止这种行为

Nuget.exe命令具有类似的行为,但是默认情况下,无论可用的源是什么,都会添加该命令


我相信这种行为确实因版本不同而有所不同。您使用的是什么版本?

谢谢Ben。我会查一查。我使用的是1.5.20902.9026Ben版本,vsix包中的代码在哪里?您是否反映/查看了其中一个DLL?您可以在找到代码-因此我没有真正做任何特别的事情!:)谢谢你,本。我已冒昧地将您的CodePlex答案中的exptra信息复制到我问题的更新中。
    if (officialFeed == null)
    {
        // There is no official feed currently registered

        // Don't register our feed unless the list is empty (other than the aggregate). This is the first-run scenario.
        // It also applies if user deletes all their feeds, in which case bringing back the official feed makes sense.
        if (_packageSources.Count > 1)
        {
            return;
        }

    }