Daniel Vygolov Daniel Vygolov - 1 year ago 87
Git Question

Use custom NuGet feed in Visual Studio Online

I've got a Visual Studio project that depends on some NuGet packages that are available from our company's feed. That feed is accessible from the web. The project is stored in Visual Studio Online in Git repository. But those NuGet packages aren't! I'd like to use VSO's automated builds and continuous integration features. How can I "tell" VSO that those NuGet packages shouldn't be downloaded from nuget.org and should be taken from www.example.com? Is there a way to do it?

Answer Source

You should have a nuget.config in your solution like this

<?xml version="1.0" encoding="utf-8"?>
        <add key="enabled" value="True" />
        <add key="automatic" value="True" />
        <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
        <add key="myCompany" value="http://XX.XX.XXX.XX:81/$pathToMyFeed$" />
        <add key="All" value="(Aggregate source)" />

Note the packageSources section. By adding your private feed in here you make it available to the solution when resolving packages. When building, both sources should be used to resolve packages.

NB the nuget.config file should be located in the .nuget folder in the root of the solution

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download