在 VS2012 中添加 NuGet 包作为项目引用的最佳方法? [英] Best way to add NuGet packages as project references in VS2012?

查看:35
本文介绍了在 VS2012 中添加 NuGet 包作为项目引用的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的.非常快的问题,我可能只是很厚.

Ok. Really quick question, I'm probably just being thick.

如果您右键单击项目的references"文件夹,然后单击Manage NuGet Packages",您就可以安装包,您单击的项目会自动引用它们.但是后来我想在同一解决方案中添加对其他项目的相同引用.如果您重复上一步但单击另一个项目,唯一的选择是卸载该包(因为它已安装),添加现有(已安装)NuGet 包作为项目引用的正确方法是什么?我是否要使用普通对话框添加引用并浏览"到包文件夹中的 dll?使用一种方法添加第一个引用然后另一个用于后续引用?这似乎不对.

If you right-click on a projects 'references' folder then 'Manage NuGet Packages' you can then install packages and they are automatically referenced by the project you clicked on. But then I want to add the same reference to other projects in the same solution. If you repeat previous but click on another project the only option is to uninstall the package (since it's already installed), what is the proper way to add an existing (already installed) NuGet package as a project reference? Am I to add the reference using the normal dialog and 'browse' to the dll in the packages folder? Use one method to add the first reference then another for subsequent references? That doesn't seem right.

推荐答案

您可以使用Manage NuGet package for Solution...:

  • 右键单击解决方案
  • 工具>库包管理器管理解决方案的 NuGet 包

然后您可以选择在哪些项目中安装包,如下面的屏幕截图所示:此外,您可以使用相同的 Manage NuGet packages for Solution... 将已安装的包添加到解决方案中的另一个项目.

Then you can choose in which projects install package as on screenshot below: Additionally you can add installed package to another projects in solution using the same Manage NuGet packages for Solution....

这篇关于在 VS2012 中添加 NuGet 包作为项目引用的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆