I'm trying to follow the no-commit strategy in keeping assemblies out of TFS while using NuGet. I'd like the projects to auto-restore dependencies and not add pending changes to TFS.
I've read a few ways to do this; one being using .tfignore, which will be a pain with the number of projects we have. We could cloak the folder in TFS, but we would need to add the packages folder for every project in order to cloak it. The last way, is to configure NuGet via NuGet.config using disableSourceControlIntegration which will keep the NugetClient from adding the packages to the project or solution.
**This is the configuration XML I'm using:
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
If I place it in my {SolutionDir}.nuget folder it works for that solution. I'm trying to place it in my %AppData%\nuget folder so that it is applied to all solutions but package restore is still causing TFS to add my packages folder contents.
I'm using Visual Studio 2013, NuGet 2.8.6 and TFS from VSOnline.**
I dont think there is a way to put this key in the root location, looks like Nuget only honors the key when it is specified in the {SolutionDir}.nuget folder. The Nuget document clearly mentions that this key works at solution level and need to added to the {SolutionDir}.nuget folder.
Source Control Integration "disableSourceControlIntegration" under section "solution" allows you to disable source control integration for the "Packages" folder. This key works at the solution level and hence need to be added in a NuGet.config file in the "$(SolutionDir).nuget directory". The default value for this key is true.
EDIT & UPDATE : thanks to @TonyStewart871 for finding this information. I haven't tested this in Version 3.2 nor could find the official documentation.
But as per this GITHUB LINK Comments Section, from NuGet version 3.2 it is possible to add the key "disableSourceControlIntegration" at the user level for all solution's in the %appdata%\nuget\nuget.config file instead of adding at the individual solution level. Please find below the comment from deepakaravindr:
"You can add the setting not just to the solution level nuget.config, but also to your nuget.config at %appdata%\nuget. That works too! Just that it will get applied to every solution that you open on that machine. Remember to add the following section as a child to < configuration > section. And, note that the setting should always be under the < solution > section for it to work"
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
NUGET Documentation
There is a DisableSourceControlIntegration-TFS NuGet package that will add the {SolutionDir}.nuget folder and config files to the solution, as well as a .tfignore file for the NuGet packages folder. It's even easier than adding a single config file by hand. You can find it here: https://www.nuget.org/packages/DisableSourceControlIntegration-TFS.
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