How do I specify the directory where NuGet packages are installed?

后端 未结 3 1660
被撕碎了的回忆
被撕碎了的回忆 2020-12-11 14:53

How to do to specify the directory where I want install package? Because I need install packages in a project where others devs work and when they do download of the project

相关标签:
3条回答
  • 2020-12-11 15:06

    The packages go in $(SolutionDir)\packages. You have two options:

    1. Check the packages folder into source control
    2. Use NuGetPowerTools so that developer machines will automatically fetch the packages when you build
      • Type "Install-Package NuGetPowerTools" in the Package Manager Console
      • Type "Enable-PackageRestore" in the Package Manager Console
        • This adds a $(SolutionDir).nuget folder, which contains an MSBuild target that will fetch the packages when they're required (eg. if you build on a machine that doesn't already have them). You must check the .nuget folder, and associated csproj changes into source control!!

    I'd recommend not checking the packages folder in, since binary files in DVCS make for slow clones :-( In the next version of NuGet, you won't need NuGetPowerTools to avoid checking it in :-)

    0 讨论(0)
  • 2020-12-11 15:09

    You can now change the default $(SolutionDir)\packages folder. See this thread: Is it possible to change the location of packages for NuGet?

    0 讨论(0)
  • 2020-12-11 15:16

    Use -OutputDirectory.

    From NuGet CLI reference.

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