Can new projects in VS2017 store nuget packages in project packages director?
msbuild, nuget, visual-studio-2017
Solution
You can change the location for the global package folder to a solution-local location by specifying a path in a `NuGet.Config` file next to the solution (note that you have to re-open the solution for this to have an effect):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="globalPackagesFolder" value=".\packages" />
</config>
</configuration>
There are two properties that can be set this way to affect the location of where the packages will be restored to. `repositoryPath` for `packages.config` projects and `globalPackagesFolder` for `project.json` and projects using`PackageReference`.
Problem
Through automatic nuget restore is convenient it is not safe. I previously checked in all packages into the repository. This was easy as VS created a packages directory under the project root. Now I find I have a ``` ~/.nuget ``` directory outside the project hierarchy. Is there a way to revert the behavior? Perhaps a flag in the `*.csproj` file?