Recursively include Nuget DLLs via Gitignore

后端 未结 2 964
梦毁少年i
梦毁少年i 2021-02-08 13:44

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

相关标签:
2条回答
  • 2021-02-08 14:10

    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.

    0 讨论(0)
  • 2021-02-08 14:16

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

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

    0 讨论(0)
提交回复
热议问题