2011-11-02 88 views
0

我进入软件包管理器 - >软件包源码选项并删除NuGet官方软件包源码,以便只有我的本地源码可用。然后我关闭visual studio 2010.只要我重新打开Visual Studio,NuGet官方软件包源代码仍然位于可用软件包源的顶部。 https://go.microsoft.com/fwlink/?LinkID=206669无法摆脱NuGet官方软件包源码

我试着导出和导入设置,删除相关的suo文件无济于事。即使我没有打开解决方案,也会发生这种情况。

我发现的一件事是,当我第二次打开VS时,下面的配置文件是正确的。 C:\ Documents和Settings {名为myUsername} \应用数据\的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 

现改成...

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <packageSources> 
    <!-- new line below --> 
    <add key="NuGet official package source" 
     value="https://go.microsoft.com/fwlink/?LinkID=206669" /> 
    <add key="Local Package Source" 
     value="http://nuget:8081/DataServices/Packages.svc/" /> 
    </packageSources> 
    <activePackageSource> 
    <add key="All" value="(Aggregate source)" /> 
    </activePackageSource> 
</configuration 

该文件的选项对话框打开时没有得到改变,只是当我点击的选项树视图中的包管理器。

它从哪里得到这个设置,为什么它会一直插入它?

更新从本Phegan上复制同样的问题在CodePlex上

http://nuget.codeplex.com/workitem/1696

“我认为这可能是与AddOfficialPackageSourceIfNeeded()这里的执行的问题” ...... http://nuget.codeplex.com/SourceControl/changeset/view/2b36b2e1935a#src%2fVisualStudio%2fPackageSource%2fVSPackageSourceProvider.cs

回答

2

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

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命令具有类似的行为,但默认情况下会添加它,无论可用的来源如何。

我相信这种行为确实因版本而异。你使用什么版本?

+0

谢谢本。我会检查这一点。我正在使用版本1.5.20902.9026 –

+0

Ben,vsix包中的行踪是那个代码?你是否反映/窥视了其中一个dll? –

+0

你可以在http://nuget.codeplex.com找到代码 - 所以我没有做任何特别的事情! :) –