Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

How Does Nuget Decide Where To Install Packages Within A Solution

$
0
0

I noticed a curious thing when installing some Nuget packages and am hoping someone can shed some light on why it happens.

I have a VS 2022 solution with the following layout:

MySolution.sln  MySolution.proj  CustomLibrary_1.proj  CustomLibrary_2.proj  BaseLibrary.proj

BaseLibrary is the base and does not depend on anything else.

CustomLibrary_1 and CustomLibrary_2 reference BaseLibrary.

MySolution is at the top and references CustomLibrary_1 and CustomLibrary_2.

I go to BaseLibrary and install a Nuget package using the VS GUI however (right click on the project, Manage Nuget Packages). I expected the package to be installed into BaseLibrary\Packages, but it gets installed to MySolution\Packages. There is no Packages folder for BaseLibrary however it does have a Packages.conf.

So my questions is:

  1. Why do the packages get installed to the MySolution\Packages and not BaseLibrary\Packages? It looks like it's something to do with how the Solution also has a project named the same thing because when I look at the project file for BaseLibrary, I see entries like "..\MySolution\packages\SomePackage\lib\net452\SomePackage.dll".

Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>