Craftsman at Work

I'm Artur Karbone, coding software architect and independent IT consultant and this is my blog about craftsmanship, architecture, distributed systems, management and much more.

NuGet: How Visual Studio stores custom feeds

To manage nuget feeds available to all projects/solutions go to
Tools -> Options -> Nuget Package Manager -> Package Sources or Tools -> Nuget Package Manager -> Package Manager Settings


Or click Ctrl+Q and type nuget

Enter new or modify existing feed. The new feeds entered via this window are stored in %APPDATA%\NuGet\NuGet.config file.

When you manage NuGet packages for the solution you can either choose specific feed or all of them if there are many:

NuGet's behavior is driven by the accumulated/inherited settings in one or more NuGet.Config (XML) files that can exist at solution, user, and computer-wide levels. Inheritance rules, described here
Usually Nuget.conig is placed In a solution folder and the settings are applied to all projects in subfolders. Note that if a config file is placed in a project folder, it has no effect on that project.

Sometimes it makes sense to discard all the inherited rules via <clear> element and aplly solution level configuration only:

<?xml version="1.0" encoding="utf-8"?>  
    <add key="disableSourceControlIntegration" value="true" />
    <!-- remove any machine-wide sources with <clear/> -->
    <clear />
    <add key="If Feed" value="" />

In this case, only sources specified in NuGet.config at the solution level will be available


comments powered by Disqus