Troubleshooting Team City NuGet Installer

Categories Nitty-gritty stuff

So you are troubleshooting your NuGet packages retrievement or installing in TeamCity? It is very hard to do because DLLs are cached and NuGet engine does not try to retrieve packages, which are already installed. This leads to the situation where you change some settings to see what happens but nothing really happens. I had this same situation while setting NuGet Installation build step. I was changing the set of NuGet sources, but nothing changed. Then I just removed all NuGet sources, but builds were still successful. I had almost gone crazy, but then I recalled – this kind of problems are usually related to some kind of cache. First I checked if there are any global settings of NuGet in TeamCity, did not find any. And after a while I have learned – in order to be sure that your packages installation runs completely, you have to:

  1. Delete  “packages” folder in your solution. This is to ensure that NuGet actually downloads something and puts it in right place;
  2. Delete all files in C:\Windows\SysWOW64\config\systemprofile\AppData\Local\NuGet\Cache folder (this is for 64-bit architecture, for 32-bit machine everything is in System32 folder). When Team City sees package ID in packages.config file it first looks in this folder for cached packages;
  3. Also, check what is in C:\Users\alexa\AppData\Roaming\NuGet\NuGet.Config if you have Visual Studio installed. Visual Studio uses this file to store NuGet configurations, because they are not saved anywhere in project or solution files.

Leave a Reply

Your email address will not be published.