如何指定安装NuGet包的目录?

时间:2023-01-13 11:32:16

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 they need have all packages in your pc.

如何指定我想要安装包的目录?因为我需要在其他开发人员工作的项目中安装软件包,当他们下载项目时,他们需要在你的电脑上安装所有软件包。

3 个解决方案

#1


8  

Use -OutputDirectory.

From NuGet CLI reference.

从NuGet CLI参考。

#2


7  

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

这些包进入$(SolutionDir)\ p​​ackages。你有两个选择:

  1. Check the packages folder into source control
  2. 检查packages文件夹到源代码管理中

  3. Use NuGetPowerTools so that developer machines will automatically fetch the packages when you build
    • Type "Install-Package NuGetPowerTools" in the Package Manager Console
    • 在程序包管理器控制台中键入“Install-Package NuGetPowerTools”

    • 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!!
      • 这会添加一个$(SolutionDir).nuget文件夹,其中包含一个MSBuild目标,该目标将在需要时获取这些包(例如,如果你在没有它们的机器上构建)。您必须检查.nuget文件夹,并将关联的csproj更改到源代码管理中!

    • 在程序包管理器控制台中键入“Enable-PackageRestore”这会添加一个$(SolutionDir).nuget文件夹,其中包含一个MSBuild目标,该目标将在需要时获取程序包(例如,如果您构建在不需要的程序包上)已经有了他们)。您必须检查.nuget文件夹,并将关联的csproj更改到源代码管理中!

  4. 使用NuGetPowerTools,以便开发人员机器在包管理器控制台中构建类型“Install-Package NuGetPowerTools”时自动获取包。在包管理器控制台中键入“Enable-PackageRestore”这将添加$(SolutionDir).nuget文件夹,其中包含一个MSBuild目标,它将在需要时获取包(例如,如果你在没有它们的机器上构建)。您必须检查.nuget文件夹,并将关联的csproj更改到源代码管理中!

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 :-)

我建议不要检查包文件夹,因为DVCS中的二进制文件可以实现慢速克隆:-(在NuGet的下一个版本中,您不需要NuGetPowerTools来避免检查它:-)

#3


4  

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

您现在可以更改默认的$(SolutionDir)\ p​​ackages文件夹。看到这个主题:是否可以更改NuGet包的位置?

#1


8  

Use -OutputDirectory.

From NuGet CLI reference.

从NuGet CLI参考。

#2


7  

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

这些包进入$(SolutionDir)\ p​​ackages。你有两个选择:

  1. Check the packages folder into source control
  2. 检查packages文件夹到源代码管理中

  3. Use NuGetPowerTools so that developer machines will automatically fetch the packages when you build
    • Type "Install-Package NuGetPowerTools" in the Package Manager Console
    • 在程序包管理器控制台中键入“Install-Package NuGetPowerTools”

    • 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!!
      • 这会添加一个$(SolutionDir).nuget文件夹,其中包含一个MSBuild目标,该目标将在需要时获取这些包(例如,如果你在没有它们的机器上构建)。您必须检查.nuget文件夹,并将关联的csproj更改到源代码管理中!

    • 在程序包管理器控制台中键入“Enable-PackageRestore”这会添加一个$(SolutionDir).nuget文件夹,其中包含一个MSBuild目标,该目标将在需要时获取程序包(例如,如果您构建在不需要的程序包上)已经有了他们)。您必须检查.nuget文件夹,并将关联的csproj更改到源代码管理中!

  4. 使用NuGetPowerTools,以便开发人员机器在包管理器控制台中构建类型“Install-Package NuGetPowerTools”时自动获取包。在包管理器控制台中键入“Enable-PackageRestore”这将添加$(SolutionDir).nuget文件夹,其中包含一个MSBuild目标,它将在需要时获取包(例如,如果你在没有它们的机器上构建)。您必须检查.nuget文件夹,并将关联的csproj更改到源代码管理中!

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 :-)

我建议不要检查包文件夹,因为DVCS中的二进制文件可以实现慢速克隆:-(在NuGet的下一个版本中,您不需要NuGetPowerTools来避免检查它:-)

#3


4  

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

您现在可以更改默认的$(SolutionDir)\ p​​ackages文件夹。看到这个主题:是否可以更改NuGet包的位置?