Can new projects in VS2017 store nuget packages in the project packages directory?

With nuget auto-repair, it's handy that it's not safe. I have previously checked out all packages in the repository. This was easy as VS created a package directory under the project root.

Now I find that I have

~/.nuget 

      

outside the project hierarchy. Is there a way to get the behavior back? Maybe a flag in the file *.csproj

?

+3


source to share


1 answer


You can change the location of the global package folder to the local location of the solution by listing the path in the file NuGet.Config

next to the solution (note that you need to reopen 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 to affect the location where packages are restored. repositoryPath

for projects packages.config

and globalPackagesFolder

for project.json

and projects using PackageReference

.

+5


source







All Articles