6

I've recently uninstalled Service Fabric and its SDK from my machine. However, it has left behind a machine-wide package source:

Microsoft Azure Service Fabric SDK
C:\Program Files\Microsoft SDKs\Service Fabric\packages

This folder no longer exists. It is causing my build to fail. Unticking this option as an available source doesn't seem to persist between sessions.

How can I permanently remove this package source?

UPDATE

In the Visual Studio options, delete is not available for this package source. I can untick it, but that doesn't seem to be persistent.

My NuGet.config doesn't reference it either. I can't find another NuGet.config on my computer.

Nuget Package Sources

%AppData%\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="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
  </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>
</configuration>
Hand-E-Food
  • 12,368
  • 8
  • 45
  • 80

4 Answers4

21

I found that deleting this file (as an Administrator) solved the problem. It must have been missed by the Service Fabric uninstaller.

C:\Program Files (x86)\NuGet\Config\ServiceFabricSDK.config

Hand-E-Food
  • 12,368
  • 8
  • 45
  • 80
  • This also helped with finding other machine wide nuget config sources that were causing issues with using "dotnet tool install --global PowerShell" removing the private sources that required authentication allowed the command to complete successfully. – Joe.P Jan 07 '20 at 21:11
  • 2
    had a similar issue with DevExpress. solved by deleting C:\Program Files (x86)\NuGet\Config\DevExpress21.1.config – SzilardD Nov 01 '21 at 05:57
3

just delete unwanted .config files in C:\Program Files (x86)\NuGet\Config

geek11
  • 41
  • 1
  • 5
  • This one, in combination with deleting folder bin, obj and .vs, and clearing NuGet caches, finally solved my problem. Don't know which of these was critical, but getting rid of outdated entries is of course great anyway. The error messages hinted this issue was a problem. – Bent Tranberg Nov 15 '21 at 09:08
2

I had this same issue on an Azure Devops build machine, which was causing a build failure when it would build locally and on other build machines. Found this file here: C:\Program Files (x86)\NuGet\Config\nuget.config which contained the offending packages.

deleted the nuget.config file at that location and worked like a charm. Hope this helps someone.

0

How can I permanently remove this package source?

When we create Service Fabric application with Visual Studio, we always receive following message in the output window:

An error occurred attempting to configure NuGet to reference the Service Fabric SDK package location as a package source. To fix this, you can manually add a NuGet package source in the Options window and setting it to the following path: C:\Program Files\Microsoft SDKs\Service Fabric\packages.

You may configure nuget setting as suggestion.

So, to permanently remove this package source, you can open the visual Studio Tools->NuGet Package Manager->Package Manager settings->Package Source:

enter image description here

Select that nuget package source and delete it. Or you can open the configuration file nuget.config directly from path C:\Users\<UserName>\AppData\Roaming\NuGet\nuget.config and delete it:

<?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="Test" value="C:\Program Files\Microsoft SDKs\Service Fabric\packages" />
  </packageSources>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  ...
</configuration>

Move the package source <add key="Test" value="C:\Program Files\Microsoft SDKs\Service Fabric\packages" />.

Hope this helps.

Jhonny D. Cano -Leftware-
  • 17,663
  • 14
  • 81
  • 103
Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • Thanks, but unfortunately, my Service Fabric source is on the lower half of that window where you can't delete from. Question edited to reflect. – Hand-E-Food Feb 26 '19 at 23:15