Search code examples
nugettfsbuild

tfs nuget step fails to get an older version of package


During the running of a TFS NuGet Installer build step, I get the below error reported. I have replaced the package name with "some package" in this example as I don't think this is relevant, however it is the only package that yields a failure

##[error]Unable to find version '2.2.1' of package '<some package>'.
##[error]Unexpected exit code 1 returned from tool NuGet.exe

The package I am trying to include exists on my nuget server (ProGet) and the version I need is not the latest version. When working in VS2017 the package is restored as expected so the issue only occurs when TFS runs its build.


Solution

  • I had an issue relating to the nuget Installer Build Steps.

    The version that your build is including may not be compatible with the version of the package library.

    To fix this I found the location of the nuget.exe under the TFS build agent tools:

    C:\Program Files\Microsoft Team Foundation Server 14.0\Build\Agent\Worker\Tools\NuGet.exe

    Add this to the Advanced part of the nuget installer build step.

    picture of advanced part on Nuget Installer