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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With