Search code examples
asp.net-mvcgitnugetgitignore

Recursively include Nuget DLLs via Gitignore


I am using GIT with a new ASP.NET MVC project. I have a line in my gitignore file to ignore dlls

*.dll

I would like to add something along the lines of the following to include (i.e. do not ignore) DLLs in my NUGET packages folder

  !/packages/*.dll

The problem I'm encountering is that not all nuget packages are created equally and, depending on the package in question, DLLs may be nested an arbitrary number of levels in the path hierarchy. It seems that I simply need a recursive solution along the lines of:

!/packages/**/*.dll

!/packages/**/*

I have not yet found a solution that will work via mysysgit (or any windows distribution of git).

Does anyone know of a way to make this work???


Solution

  • Leave your top level gitignore alone by keeping *.dll in it.

    Create another .gitignore file in the packages directory and put !*.dll in it.