Recursively include Nuget DLLs via Gitignore

此生再无相见时 提交于 2019-12-03 07:08:44

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

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

Another option to consider is NOT including your NuGet dlls in your repository and instead only download them the first time you build your project. This is what we do with all of our NuGet dependencies.

UPDATE

Nuget handles this now without having to manually create your own build events. See the details on this page: http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages


Original Answer:

We put the NuGet.exe application in a tools folder under our solution, and then add the following to our project pre-build event.

"$(SolutionDir)Tools\NuGet.exe" install "$(ProjectDir)packages.config" -o "$(SolutionDir)Packages"

The first time we build the app it will download all of the dependencies, but with subsequent builds, NuGet is smart enough to see that they already exist at the correct version and skips them.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!