nuget package restore behavior on build machines

Topics: General
Feb 15, 2013 at 2:56 AM
I've been using the cloud SaaS tfs [ // ] for alm and an azure IaaS vm operated build controller + agents for some work and the tfs SaaS provided build controller + agent pool services for other release work.

On my build agents I configured the system environment variable EnableNuGetPackageRestore = true so that when automated builds execute the enable nuget package restore settings used in our release work, to keep $(SolutionDir)packages binaries out of our version control repository, can do its thing. This is because automated build runs using the NetworkService machine account setting where no vs12 | tools | library package manager | settings | allow nuget to download missing packages during build setting applies.

It would seem that nuget package restore retrieves package specific versions using $(ProjectDir)packages.config contained settings.

q1 - does that mean nuget package restore should be expected to work when packages in question are unlisted // packages that require the version switch to be specified when using package manager console to retrieve them?

q2 - what will nuget package manager do in these automated build machine cases when one of the packages that needs to be restored comes from a package source other than //, e.g. can you specify global package source settings that builds running under the NetworkService machine account will see and use to do package restores during automated build?
Feb 15, 2013 at 1:34 PM

1: yes, package restore will continue to work with unlisted packages.

2: if you open the nuget.targets file under your $(SolutionDir).nuget folder, you will see this element:

 <ItemGroup Condition=" '$(PackageSources)' == '' ">
        <!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
        <!-- The official NuGet package source ( will be excluded if package sources are specified and it does not appear in the list -->
            <PackageSource Include="" />
            <PackageSource Include="https://my-nuget-source/nuget/" />
The comment tells you exactly how to register additional package sources.
Feb 15, 2013 at 7:57 PM
Perfect. Looks like we are covered when it comes to automated build restore packages behavior especially when cloud tfs hosted build controller & agent processed builds are executing.