Does Nuget create two package folders?

Ok

So, I recently reinstalled Windows 10 and updated vs2013 β†’ vs2015. At this point, I tried to grab a couple of nuget packages.

The problem is that I have the .nuget / packages folder at the same level as the solution file (installed via NuGet.config), but I also have the exact same folder created in the root of my user folder.

the packages folder for my solution contains the packages installed for this solution, and the one I don’t want in my user directory contains all the packages for all the projects and solutions that I am working on.

Is there a way to prevent this .nuget folder created in my user directory? it seems useless when i already have folder folders for my solutions

thanks

+4
source share
1 answer

You can clear the .nuget\packages directory under your user profile, however packages will be downloaded again if you install them again.

Package Search

%USERPROFILE%\.nuget\packages is the local computer cache used by NuGet v3 when installing NuGet packages for new types of projects, such as Universal Windows projects.

For a C # console project, NuGet will use the %LOCALAPPDATA%\NuGet\Cache directory, which also uses NuGet v2.

ASP.NET Core projects currently use their own %USERPROFILE%\.dnx\packages for NuGet packages.

Specifying a Custom NuGet Package Location

To prevent NuGet from copying packages to your user profile, you can create a new environment variable %NUGET_PACKAGES% , indicating the place where you want NuGet to copy files, for example. C:\git-repositories\.nuget\packages .

To prevent NuGet from copying packages to the solution folder, you can also create a new NuGet.config file either in the solution folder or at any higher level to the root. You can specify the following XML as content.

 <?xml version="1.0" encoding="utf-8"?> <configuration> <config> <add key="repositoryPath" value="C:\git-repositories\.nuget\packages" /> </config> </configuration> 

For help with configuration inheritance, go to this link: NuGet Inheritance Inheritance

+9
source

All Articles