如何在 visual studio 解决方案的部署中使用 nuget 包
How to use nuget packages in deployment for a visual studio solution
我有一个包含多个 C# 项目的解决方案。其中一些项目将 nuget dll 作为参考。
默认情况下,nuget 将所有 dll 拉到解决方案文件夹中名为 packages 的文件夹(dll 可能依赖于其他 nuget dll,因此 nuget 也将它们拉到 packages 文件夹)。这适用于正常构建。
现在我想将我的应用程序部署到所有 .dll 都在一个文件夹中的位置。将所有 nuget dll 收集到该文件夹中的最佳方法是什么。
注意:在向项目添加Nuget引用时,CopyLocal
默认设置为true
,因此nuget dll被复制到bin中该项目的文件夹。所以,我可以从那里提取那些 dll。但是我不确定如何提取二阶依赖项(我引用的 nuget dll 所依赖的其他 nuget dll),因为它们没有复制到项目的 bin 文件夹中。
But I am not sure how to pull the second order dependencies(Other nuget dlls on which the nuget dlls I reference depend on) as they are not copied to the bin folder of projec
Any time a package is installed or reinstalled, which includes being
installed as part of a restore process, NuGet also installs any
additional packages on which that first package depends.
Those immediate dependencies might then also have dependencies on
their own, which can continue to an arbitrary depth.
所以,当我们在项目中安装一个nuget包时,NuGet会将nuget包dll及其依赖添加到项目中。此外,NuGet 会默认将 CopyLocal
的 属性 设置为 True
作为依赖项。在这种情况下,所有依赖项也将被复制到 bin
文件夹中。
比如我们安装nuget包Microsoft.Owin
到Asp.net应用项目时,它的依赖owin
也会默认安装到项目中,而属性 的 CopyLocal
也默认设置为 True
。安装完成后,依赖项owin
将复制到bin
文件夹。
因此,要解决此问题,请确保已安装的 nuget 包的依赖项也添加到项目中,并检查 CopyLocal
的 属性 是否设置为 True
.
我有一个包含多个 C# 项目的解决方案。其中一些项目将 nuget dll 作为参考。 默认情况下,nuget 将所有 dll 拉到解决方案文件夹中名为 packages 的文件夹(dll 可能依赖于其他 nuget dll,因此 nuget 也将它们拉到 packages 文件夹)。这适用于正常构建。
现在我想将我的应用程序部署到所有 .dll 都在一个文件夹中的位置。将所有 nuget dll 收集到该文件夹中的最佳方法是什么。
注意:在向项目添加Nuget引用时,CopyLocal
默认设置为true
,因此nuget dll被复制到bin中该项目的文件夹。所以,我可以从那里提取那些 dll。但是我不确定如何提取二阶依赖项(我引用的 nuget dll 所依赖的其他 nuget dll),因为它们没有复制到项目的 bin 文件夹中。
But I am not sure how to pull the second order dependencies(Other nuget dlls on which the nuget dlls I reference depend on) as they are not copied to the bin folder of projec
Any time a package is installed or reinstalled, which includes being installed as part of a restore process, NuGet also installs any additional packages on which that first package depends.
Those immediate dependencies might then also have dependencies on their own, which can continue to an arbitrary depth.
所以,当我们在项目中安装一个nuget包时,NuGet会将nuget包dll及其依赖添加到项目中。此外,NuGet 会默认将 CopyLocal
的 属性 设置为 True
作为依赖项。在这种情况下,所有依赖项也将被复制到 bin
文件夹中。
比如我们安装nuget包Microsoft.Owin
到Asp.net应用项目时,它的依赖owin
也会默认安装到项目中,而属性 的 CopyLocal
也默认设置为 True
。安装完成后,依赖项owin
将复制到bin
文件夹。
因此,要解决此问题,请确保已安装的 nuget 包的依赖项也添加到项目中,并检查 CopyLocal
的 属性 是否设置为 True
.