gitignore–Don’t ignore Nuget Binaries

I am pretty new to the GIT world and am excited to be moving a personal project from Subversion to GIT. As with most .NET developers’ .gitignore files, I use the following line to filter out DLLs so that I am not versioning build DLLs
*.dll

I ran into an issue where I wanted to exclude all DLLs except for those stored in my Nuget packages directory. This wouldn’t in itself be an issue were it not for the fact that Nuget packages diverge wildly with respect to the number of nested sub-folders. Where one package might store it’s DLLs one folder down the directory hierarchy, another might store theirs down 10…

I searched for a recursive wildcard pattern that would work via mysysgit but hit a brick wall as none of the following worked:

!/packages/**/*.dll
!/packages/**/*

While I hoped for a cleaner solution it turned out that all I had to do was add another .gitignore to my packages directory containing only the following line:

!*.dll

Obviously this would work just as well for !*.exe or any other relevant binary file type…

Comments

Anonymous said…
For the readers of this blog post, note that as of NuGet 1.6 it is OK to exclude the "packages" folder from your source control and nuget will automatically download missing packages.

Popular posts from this blog

Excel - Adding an existing Pivot table to the data model

Getting Started with Mirth (Part 1)

Mirth