I have the following project structure:
*Note: App2 project is referenced by App1.
My problem is that whenever I rebuild the solution, the \packages folder containing nuget packages for App2 project, is added to \App1 instead of \App2.
This is a problem because this App2 project is referenced by other solutions as well, not only from App1.
So it is important to have it's own \packages folder and not to have a reference from App2 --> App1, since App2 is shared by other solutions as well.
Update: The App1 has its own nuget packages installed in it's own \packages folder. I want a solution for keeping each project installing nuget packages in its own \packages folder.
You can add NuGet.config file to your solution, which will change default path to the packeges folder:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositorypath" value="..\..\packages" />
</config>
</configuration>
Of course you need to put a relative path which is correct in the specific solution. A solution-specific NuGet.Config file should be located within a .nuget folder in the solution.
Here: https://docs.nuget.org/ndocs/consume-packages/configuring-nuget-behavior you have a detailed description of this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With