.gitignore, Visual Studio and NuGet

I have started using git for some projects again and one of the first things I needed to do was define a suitable .gitignore file for Visual Studio to avoid adding user-specific or temporary files to the repository.

Fortunately, there are plenty of examples of these on StackOverflow – for example this question is a good starting point.

Of course, no sooner had I created a suitable .gitignore (which I should really add to a dotfiles git repository as well) than I realised that I’d also have to handle DLLs and other files and references set up by NuGetthis blog entry has the following suggestion:

# Include dlls if they’re in the NuGet packages directory
!/packages/*/lib/*.dll