Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget: Change package directory path and name [duplicate]

Is it possible to change the name and the path of the created nuget package directory?

My current folder structure is like this:

+src

++Project1

++Project2

++packages

I'd like to have a folder structure like this:

+Lib (packages)

+src

++Project1

++Project2

like image 266
Rookian Avatar asked Oct 03 '11 16:10

Rookian


People also ask

Is it possible to change the location of packages for NuGet?

If you're using Visual Studio 2019 and NuGet version 4 (or above), you may change the path by editing the NuGet. config file. Add "globalPackagesFolder" and "repositoryPath" keys to the config file. Set the values that you wanted.

What is .NuGet folder?

nuget folder is used as a cache for packages downloaded to speed up project restore and compilation. It can safely be removed.

Where is .NuGet folder located?

The location of the default global packages folder. The default is %userprofile%\. nuget\packages (Windows) or ~/. nuget/packages (Mac/Linux).


1 Answers

You can do this by creating a file called nuget.config and storing it in the same location as your solution file.

The config file should look like this:

<settings>
    <repositoryPath>../libs/packages</repositoryPath>
</settings>

That's it.

Obviously you can put whatever path you want. Hope that helps.

like image 174
Brett Allred Avatar answered Oct 02 '22 16:10

Brett Allred