In your %AppData%\NuGet\NuGet.Config
file, add the following just before the </configuration>
XML tag...
<config>
<add key="repositoryPath" value="C:\NuGetPackages" />
</config>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
...you can specify any path you want - the important thing is putting it OUTSIDE your TFS workspace!
Now you never have to worry about that stuff again. Your solution folder will not contain any packages anymore; all solutions will default to using your custom packages location instead.
NOTE - This works is on a per-user basis.
Until now, I've been doing the same in a one-config-per-solution (\.nuget\NuGet.Config
) manner. Thanks to @dsghi for the insight!
Make sure your solution folder does not contain a .nuget
folder (old way of doing things). Even if the folder is NOT included in the solution and only in the file system, it will override everything!