Everybody knows about NuGet right? Right? Well if you don’t, get familiar with it! NuGet is a package manager for Visual Studio that allows you to automatically restore needed references when you load a solution and run a build. This works wonders in a team environment. Now, you don’t need to worry about a reference path, or if you don’t have the right DLLs. It just restores them for you! There are hundreds of great packages out there already in the official NuGet gallery, but you can also run your own server with your own custom packages. When you install a package, it will install the dependencies for you. And keeping your packages up to date is quick and easy.
It really is a great product. But there is a downside. When you install a package it can get stored into your TFS and then keeps copies of all those required files even though it is unnecessary as they just restore at build anyway. But there is hope. As of NuGet 2.7.2, you can disable source integration of the packages so you do not clutter your source control with files that are not required to have a version history.
- Enable Package Restore on Solution: Right click on the solution and you should have this option to restore packages automatically.
- Delete Nuget.exe, Nuget.targets. Nuget.config should contain a key that says: “Disable Source Integration” and set to True.
- Save your Solution, exit.
- Open up the project file in Notepad or your favorite text editor. (vbproj or csproj).
- Search and remove all lines that say “Nuget.targets”. There typically is only one. Save.
- Delete the contents of the packages folder.
- Open your solution in Visual Studio.
- Build solution, it should restore all packages.
- Check in to TFS. This should exclude all of the packages that were just installed.
NuGet is a very easy to use package manager and streamlines a lot of issues that can occur when working on a project with multiple team members or moving between computers.