开发者

Nuget: Change package directory path and name [duplicate]

This question already has answers here: Is it possible to change the 开发者_Go百科location of packages for NuGet? (19 answers) Closed 5 years ago.

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


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.


I did it for VS 2010.

1) Get NuGet updated.

2) Add a nuget.config file to the solution folder like this:

<?xml version="1.0" encoding="utf-8"?>

<settings>
  <repositoryPath>..\..\..\Dependencies\packages</repositoryPath>
</settings>

3) Create an empty "packages" folder at the location referred by the nuget.config file.

4) Go to Tools -> Library Package Manager-> Manage Nuget Packages for Solution

5) Type "asynctargetingpack" on the search box (or any other package you prefer)

6) Install the package

7) Go to the "packages" folder at the location referred by the nuget.config file and check the package files are there.


Starting with version 2.2 you can changed the NuGet.Config file.

NuGet Configuration File

Edit the value of the "repositorypath" key (and uncomment).


This limitation is on the VS plugin, using the command line you can choose the packages directory for the install/update commands, but then you can't go back to use the plugin UI.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜