NuGet/Home

Enabling a source that is disabled in a nuget.config lower in precedence chain

Open

#6783 aperta il 6 apr 2018

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)HTML (292 fork)batch import
Priority:2Product:VS.ClientRegressionFromPreviousRTMTriage:InvestigateType:Bughelp wanted

Metriche repository

Star
 (1459 star)
Metriche merge PR
 (Merge medio 464g 23h) (1 PR mergiata in 30 g)

Descrizione

Details about Problem

NuGet product used: VS UI, NuGet.exe NuGet version (x.x.x.xxx): 4.5.1.4879 VS version (if appropriate): 15.6.5 OS version (i.e. win10 v1607 (14393.321)): Win7 SP1 7601

Worked before? If so, with which NuGet version: VS 15.6.something, and certainly 15.5.*

Detailed repro steps so we can see the same problem

  1. Open solution with custom package source (ProGet 4.6.5) and Manage NuGet Packages for Solution.
  2. Note that custom package source is unselected (no packages sources shown).
  3. Click drop down for package source...no package sources available.
  4. Click on gear icon, check package source.
  5. Click OK.
  6. Click drop down for package source...no package sources available.

Likewise, when I bring up PackageManager Console and run nuget.exe sources:

Registered Sources:

  1.  nuget.org [Enabled]
      https://api.nuget.org/v3/index.json
  2.  Lab Cache [Disabled]
      http://aoeu/nuget/external/
  3.  Microsoft Visual Studio Offline Packages [Disabled]
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

But if I look at our project's NuGet.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <solution>
    <add key="disableSourceControlIntegration" value="true" />
  </solution>
  <packageSources>
    <add key="Lab Cache" value="http://aoeu/nuget/external/" />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
  <disabledPackageSources>
    <add key="nuget.org" value="true" />
  </disabledPackageSources>
</configuration>

Somehow it is not first, and nuget.org is not disabled. Whatever, let's enable our source and attempt a restore/update/etc:

PM> &"nuget-v4.5.1.exe" source enable -name "Lab Cache"
Package source with Name: Lab Cache enabled successfully.
PM> &"nuget-v4.5.1.exe" restore solution.sln
MSBuild auto-detection: using msbuild version '15.6.85.37198' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'.
Restoring NuGet package Metrics.NET.0.5.3.
  GET http://aoeu/nuget/external/Packages(Id='Metrics.NET',Version='0.5.3')
  OK http://aoeu/nuget/external/Packages(Id='Metrics.NET',Version='0.5.3') 41ms
  GET http://aoeu/nuget/external/package/Metrics.NET/0.5.3
  OK http://aoeu/nuget/external/package/Metrics.NET/0.5.3 560ms
Installing Metrics.NET 0.5.3.
Adding package 'Metrics.NET.0.5.3' to folder 'D:\solutionfolder\packages'
Added package 'Metrics.NET.0.5.3' to folder 'D:\solutionfolder\packages'

NuGet Config files used:
    D:\solutionfolder\.nuget\NuGet.Config
    D:\userhome\AppData\Roaming\NuGet\NuGet.Config
    C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config

Feeds used:
    D:\userhome\.nuget\packages\
    http://aoeu/nuget/external/

Installed:
    1 package(s) to packages.config projects

This looks great...until I open back up VS UI for NuGet and now I find:

PM> &"nuget-v4.5.1.exe" sources
Registered Sources:

  1.  nuget.org [Enabled]
      https://api.nuget.org/v3/index.json
  2.  Lab Cache [Disabled]
      http://aoeu/nuget/external/
  3.  Microsoft Visual Studio Offline Packages [Disabled]
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

Guida contributor