2011-11-02 38 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找到代碼 - 所以我沒有做任何特別的事情! :) –