Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 268
Daniel Vygolov Avatar asked Apr 24 '15 09:04

Daniel Vygolov


1 Answers

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

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

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

like image 114
Joseph Devlin Avatar answered Sep 28 '22 00:09

Joseph Devlin