Overriding NuGet global packages folder to save storage space

As explained in this and this articles, the default location of the global packages folder is:

On Windows

%userprofile%\.nuget\packages

On Mac/Linux

~/.nuget/packages

NuGet installs downloaded packages under this folder and, because it is “per user” location, those packages can take up quite big space especially when the machine is shared by multiple users. This setting can be overridden by the NUGET_PACKAGES environment variable, which takes precedence. In this variable we can provide a common location for the machine, to avoid redundant copies of the same nuget packages in different user accounts, thereby saving storage space.

We can add a system-wide environment variable on Windows as shown below:

Once added, to make it work, we need to restart the UiPath Robot service (if it’s installed as a service), or restart the machine. After restart, we can remove the user downloaded nuget packages to free up the storage space.

2 Likes