6

We have a private NuGet server and my issue is the TFS 2017 builds don't recognize the internal package's NuGet server, obviously, without specifying the URL. I've tried putting it in Nuget.config and it worked, but with some issues.

What I would like to do, however, is somehow add this to the global list of feeds. I do not have NuGet installed on the server, though NuGet restore is happening as a build Task, so it exists under c:_work_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.21\ etc, and do not see anything that would let me change the set of feeds.

BTW, when I added a package source to nuget.config, it seemed to ONLY download from that source and ignored all the defaults, such as nuget.org, etc.

How can I add an internal nuget server so that all my builds natively can access it? Thanks.

Ryan Peters
  • 7,608
  • 8
  • 41
  • 57
  • Are you using the TFS feed (set TFS as the private NuGet server) or any other priveate Nuget server? : [Get started with NuGet Package Management in VSTS and TFS](https://learn.microsoft.com/en-us/vsts/package/get-started-nuget) – Andy Li-MSFT Dec 15 '17 at 06:25
  • @Andy, why are you giving Azure-related links? I ask because I'm trying to add packages to a file share on our network. – IrishChieftain Jun 26 '19 at 12:59

2 Answers2

3

Generally you just need to add the feeds (also add the nuget.org source) to NuGet.config file, then check in the file.

(If you used the third private NuGet server, then you can have a try with the Package Management in VSTS and TFS)

e.g.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <!-- remove any machine-wide sources with <clear/> -->
    <clear />
    <!-- add a VSTS feed -->
    <add key="MyGreatFeed" value="https://fabrikam.pkgs.visualstudio.com/DefaultCollection/_packaging/MyGreatFeed/nuget/v3/index.json" />
    <!-- also get packages from the NuGet Gallery -->
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
</configuration>

For this issue : "it seemed to ONLY download from that source and ignored all the defaults, such as nuget.org, etc."

Make sure you have correctly set the NuGet.config file and the nuget.org source is not excluded.

To Restore NuGet packages in Build you can follow the steps mentioned in below article:

Restore Package Management NuGet packages in Team Build

  • If you've checked in a NuGet.config, select Feeds in my NuGet.config and select the file from your repo.
  • If you're using a single VSTS/TFS feed, select the Feed(s) I select here option and select your feed from the dropdown.
riQQ
  • 9,878
  • 7
  • 49
  • 66
Andy Li-MSFT
  • 28,712
  • 2
  • 33
  • 55
0

A bit outdated, but I also looked at a solution in our local TFS on how to integrate other local nuget feeds.

  1. Navitage to settings and select "Services"

you should now see a list of Endpoints

  1. Click on "+ Add New Service Endpoint" and select "NuGet" from the dropdown

a dialog opens where you can enter the information of your local NuGet server

  1. After saving the endpoint you should now be able to select your NuGet-Endpoint in your build, when you add a NuGet-Restore buildstep (in Version 2.*) and..

  2. in the buildstep select "Feeds in my NuGet.config" under "Feeds to use*" a dropdown should now be shown to select "Credentials for feeds outside this account/collection". In this dropdown you can select your NuGet-Endpoint.

SwissCoder
  • 2,514
  • 4
  • 28
  • 40