NuGet 3.3 restore not creating packages when running as LocalSystem


Running the build agent as LocalSystem, and using Nuget 3.3, have tried both with the "native" nuget step and a command line step. In both cases, when I specify verbose output, I see that it is trying to save packages to C:\Windows\system32\config\systemprofile\.nuget\packages\ (Using packages directory: C:\Windows\system32\config\systemprofile\.nuget\packages\). There are no errors reported in the build log. When the Visual Studio solution build step runs it reports multiple errors like "[Csc] CSC error CS0006: Metadata file 'C:\Windows\system32\config\systemprofile\.nuget\packages\Castle.Core\3.3.3\lib\net45\Castle.Core.dll' could not be found" When I look in that location, there is no folder (C:\Windows\system32\config\systemprofile\.nuget is not present). I have tried to manually create that folder and added "Full Control" permissions for "Everyone" but it still does create packages in there and I cannot build the project. I have not found any errors in Windows logs.

The only difference between this project and others that do build is that I am using project.json within the csproj to manage references. If I log onto the build agent under my own account I am able to manually execut nuget restore and msbuild and get a successful build (nuget creates the packages folder in my home directory and msbuild picks up the packages from there).

If I run the build agent under my own account (domain account, admin privileges on build agent machine), the build step succeeds, however, I'd rather not be running under a personal account.

Any ideas where I should be looking for the cause?

Comment actions Permalink

Hello Colin, 

There were some related bugs fixed in the latest TeamCity versions. Could you please upgrade to TeamCity 9.1.6 and check if the issue is reproduced?


(copied from email support)

Comment actions Permalink


We too are seeing this, on TeamCity 10.0.

Is there a bug report where I can track this? Or do you want to create one? Or do you want me to create one?





Comment actions Permalink

Hello Lasse,

Could you please attach screenshots of the build steps and full build log? Thank you!

Comment actions Permalink

Hey Alina,

I created, hope that helps.

 - Lasse



Please sign in to leave a comment.