I've read a few posts on how to do this:
- This post from David Ebbo, not much information but explains why to do it and points you in the direction of more information.
- This page from the NuGet documentation.
- Two conversations from Stack Exchange on "Ignoring all NuGet packages" and "Getting TFS to ignore the packages folder"; these didn't provide any new information but were useful for seeing the kind of problems that people were having.
So this is a step-by-step process of how to create a new solution and have (almost) all the packages kept out of TFS.
1. Create a .tfignore file
In the TFS folder that is the parent folder of all my projects I create a ".tfignore" file containing the following:
1 2 3 4 5 | *.user *.suo bin obj packages |
This instructs TFS to ignore any folder called "packages". Add the file to source control so that all your projects on all your dev machines get the benefit of this.
You would have thought that that is it, but it's not...
2. Create my new project by initially creating an empty solution file
The option to create a Blank Solution is in the "Other Project Types" section:Close Visual Studio (if you don't do this, it won't work).
3. Add a "nuget.config" in a ".nuget" folder within the new solution
Create a ".nuget" folder within the solution folder and add a "nuget.config" file to it that contains the following:1 2 3 4 5 | <configuration> <solution> <add key="disableSourceControlIntegration" value="true" /> </solution> </configuration> |
This is needed to stop NuGet.exe from trying to add packages to source control (it ignores the .tfignore file, a known issue). We want to do this before we add any projects so that NuGet uses our new settings for the packages in the initial project.
4. NOW add your projects to the solution...
In my case I added an MVC project and a Tests project. I'm hoping that in the Pending Changes window I should see NOTHING being added from the "packages" folder even though my MVC project uses loads of packages.
And this is what I see:
Almost nothing. I can't seem to stop nuget / TFS (whichever one it is that is doing it) from adding the repositories.config to source control. Fortunately this file is only about 200 bytes as opposed to the 163 MB I was putting in source control before.
If you use Git rather than TFS for source control then the only difference to this process would be that you would need to create a ".gitignore" instead of a ".tfignore" file.
Woah this blog is wonderful i like studying your posts. Keep up the great work! You understand, lots of persons are hunting around for this info, you could help them greatly.
ReplyDeletepython training in chennai
python course institute in chennai