Is it possible to tell NuGet where to store packages for the solution?

I could not find the answer to this question. I used to use Nu and was able to determine where the "gems" should be installed. For example, I like to keep the project structure as follows:

  Myproject
     | -MyProject.build
     | -MyProject.sln
     | -doc
     | -lib
     |  | - ... my packages / gems ...
     | -sql
     | -src
     |  | -app
     |  | -test
     | -tools

As you can see, I like to keep the "lib" folder for third-party libraries that are used in my solution. Using Nu, in the root directory of my project, I could just use the command:

  nu install log4net --location = lib

By doing this, you grab the requested package and put it in my "lib" folder for later reference.

So, is this possible using the "Package Manager Console" in VS.NET? Should I use some other method? Thanks for the help!

+4
source share
2 answers

Sebastian Lambla wrote a recent blog post regarding OpenWrap, but also talked about NuGet. In it, he believes that people who offer to place packages in other places do ask the wrong questions:

When the question “can I change where the packages go” is usually the main, real question is one of two: “I want them in / lib with my other traditional libraries” or “In my corporate environment I don’t want to check all the dependencies, because that I don't care about deploying xcopy. "

And then we further explain how the libraries that belong to your package manager are really not the same beasts as the other libraries you depend on.

+4
source

Sebastiens post is all beautiful, but I really don't care where the packets go. Nuget (or any package manager) should not assume that it knows better.

And he should not make a decision == complete source tree. To clarify: in my source tree contains 80+ solutions in different places, a batch repo with respect to the solution folder leads to 80 + clones of all packages, it is slow and wasteful.

while (nuget 1.3) an undocumented hack is to put the nuget.config file next to your solution with a relative repo path in it like this

<settings> <repositoryPath>..\..\lib</repositoryPath> </settings> 

it may or may not work for you, as it is a hack.

+8
source

Source: https://habr.com/ru/post/1332201/


All Articles