Repro steps:
C:\Users\daroth\Desktop\test>dotnet restore
Restoring packages for C:\Users\daroth\Desktop\test\test.csproj...
C:\Program Files\dotnet\sdk\2.0.0-preview2-006391\NuGet.targets(102,5): error : Failed to retrieve information about 'System.Diagnostics.DiagnosticSource' from remote source 'C:\Program Files\Microsoft SDKs\Service Fabric\packages\'. [C:\Users\daroth\Desktop\test\test.csproj]
The problematic machine wide feed was originally setup when I installed the service fabric SDK, which I have since removed. The configuration of the service fabric machine wide feed was left behind at C:\Program Files (x86)\NuGet\Config\ServiceFabricSDK.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="Microsoft Azure Service Fabric SDK" value="C:\Program Files\Microsoft SDKs\Service Fabric\packages\"/>
</packageSources>
</configuration>
The specified folder for the service fabric packages no longer exists, as indicated by the restore error. However, the service fabric feed is disabled in my nuget.config file at C:\Users\daroth\AppData\Roaming\NuGet\NuGet.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Local feed" value="c:\feed" />
<add key="danroth27" value="https://www.myget.org/F/danroth27/api/v3/index.json" />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="aspnetcore-dev" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json" />
<add key="aspnetcore-release" value="https://dotnet.myget.org/F/aspnetcore-release/api/v3/index.json" />
<add key="CliFallbackFolder" value="C:\Users\daroth\.dotnet\NuGetFallbackFolder" />
<add key="msbuild" value="https://dotnet.myget.org/f/msbuild/api/v3/index.json" />
</packageSources>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<bindingRedirects>
<add key="skip" value="False" />
</bindingRedirects>
<packageManagement>
<add key="format" value="0" />
<add key="disabled" value="False" />
</packageManagement>
<disabledPackageSources>
<add key="danroth27" value="true" />
<add key="dotnet-core" value="true" />
<add key="aspnetcore-release" value="true" />
<add key="aspnetcore-final" value="true" />
<add key="msbuild" value="true" />
<add key="Microsoft Azure Service Fabric SDK" value="true" />
</disabledPackageSources>
</configuration>
So I don't think it should be used at all for restore.
C:\Users\daroth\Desktop\test>dotnet --info
.NET Command Line Tools (2.0.0-preview2-006391)
Product Information:
Version: 2.0.0-preview2-006391
Commit SHA-1 hash: ef5d4b47c3
Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.0.0-preview2-006391\
Microsoft .NET Core Shared Framework Host
Version : 2.0.0-preview2-25407-01
Build : 40c565230930ead58a50719c0ec799df77bddee9
Remove C:\Program Files (x86)\NuGet\Config\ServiceFabricSDK.config does resolve the error.
Disabling the source in your user wide config should have removed it, there may be an issue here with how the config files are being prioritized.
This has been solved as part of the latest rework on the nuget.configuration code paths.
This fix may have shipped as part of 4.9. Closing this for sure now in the 5.0.0-preview2 release.
Most helpful comment
Remove
C:\Program Files (x86)\NuGet\Config\ServiceFabricSDK.configdoes resolve the error.