How to use NuGet without adding packages to TFS

Posted by Anuraj on Wednesday, October 2, 2013

.Net Team Foundation Server Version Control Visual Studio

In the recent project I was using few nuget packages. And I was using TFS. Committing these packages into TFS was increasing the size of the repository. Later I found a solution using Enable NuGet Package Restore option. You can enable this option by right clicking on the solution file or from Project > Enable NuGet Package Restore option.

Enable NuGet Package Restore option

This will show up a confirmation message like this.

Enable NuGet Package Restore Confirmation

Once you accepts it, Visual Studio will add a .nuget folder to the solution, you need to check in the solution to TFS.

.NuGet folder in solution explorer

The nuget.config file contains following XML.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <solution>
    <add key="disableSourceControlIntegration" value="true" />
  </solution>
</configuration>

The disableSourceControlIntegration setting instructs version control systems like TFS to not add the NuGet packages folder to the pending check-ins list.

Now you can delete the packages folder and try to build it again, Visual Studio will be downloading packages for you.

Build - Output Window

Happy Programming.



Did you like this article? Share it with your friends

Facebook Twitter Google+ LinkedIn Reddit StumbleUpon



MVP
Subscribe
Archives


Copyright © 2017 - Anuraj P. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Hosted with ❤ by GitHub