'How to install/Store NuGet Packages inside the Visual Studio Project's folder?

I have already read similar questions but the provided answers do not resolve my issue.

I need to put all the required NuGet packages by a project inside its own folder instead of installing it to the common user directory. I need to do this so that I can put the NuGet packages under version control to make them available on other systems because some PCs cannot get the required NuGet packages from the internet.

I have already tried to put a nuget.config file inside the solution directory (as shown below in the screenshot)

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <config>
    <add key="repositoryPath" value=".\packages" />
  </config>
</configuration>

enter image description here

...but even after doing that, when I install a new NuGet Package, the files are extracted to the common directory (i.e. C:\Users\TestUser\.nuget\packages\knockoutjs\3.5.1).

QUESTION: How can I set the extraction/installation of NuGet Packages to the project directory? enter image description here



Solution 1:[1]

Maybe you should move the nuget.config to the same directory as the solution and restart Visual Studio.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Peng Ge