0
votes

I’m trying to setup a solution to be built by TFS Build 2013. The solution uses NuGet packages from both nuget.org and an internal company repo. When building on the build server, it finds the packages from nuget.org, but not the ones from my internal repository. I have a NuGet.Config file in the solution (under the .nuget folder) that looks like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <solution>
    <add key="disableSourceControlIntegration" value="true" />
  </solution>
  <packageSources>
    <add key="NuGet official package source" value="https://nuget.org/api/v2/" />
    <add key="My Internal Package Source value="\\myserver\NuGetPackages" />
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)"  />
  </activePackageSource>
</configuration>

The error message I get is:

Unable to find version '1.0.0' of package 'MyPackageName'.

What do I need to do to get it to pick up the packages in my internal repository?

1

1 Answers

0
votes

I found an answer to my problem. I discovered that you can place a file called NuGetDefault.config in %ProgramData%\NuGet and nuget.exe will pick it up. So I created this file and put my two sources in it. (This might not work for someone who wants different projects to use different sources.)

Using Process Monitor, I discovered that nuget.exe was getting a path not found error when it tried to access my local repository in the format "\\myserver\NuGetPackages". Fortunately for me, my internal nuget server is also the one that TFS Build is installed on. So I just changed my the path to something like "D:\folder\nugetfolder".

I'm running the build under the network service account, so I had to give that account permission to access that directory. (Now that I think about it, that's probably also why I couldn't access the repo via the "\\myserver\NuGetPackages" format).

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="NuGet official package source" value="https://nuget.org/api/v2/" />
    <add key="PD Package Source" value="D:\NuGetPackages" />
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
</configuration>