如何在 Visual Studio 中向项目添加 .dll 引用 [英] How to add a .dll reference to a project in Visual Studio

查看:52
本文介绍了如何在 Visual Studio 中向项目添加 .dll 引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用 MailSystem.NET 库.但是,我无法弄清楚在哪里添加 .dll 文件,以便我可以在我的类中引用命名空间.有人可以帮帮我吗?我使用的是 Visual Studio 2010.感谢您提供任何信息,网上很少.

I am just beginning to use the MailSystem.NET library. However, I cannot figure out where to add the .dll files so I can reference the namespaces in my classes. Can someone please help me? I am using Visual Studio 2010. Thank you for any information, there is so little online.

推荐答案

将下载的 DLL 文件复制到开发驱动器上的自定义文件夹中,然后使用 Add Reference<中的 Browse 按钮​​添加对项目的引用/code> 对话框.
确保新引用具有 Copy Local = True.
在解决方案资源管理器中右键单击项目中的引用项,可以打开 Add Reference 对话框

Copy the downloaded DLL file in a custom folder on your dev drive, then add the reference to your project using the Browse button in the Add Reference dialog.
Be sure that the new reference has the Copy Local = True.
The Add Reference dialog could be opened right-clicking on the References item in your project in Solution Explorer

几年后更新
目前,解决所有这些问题的最佳方法是通过
管理 NuGet 包 Visual Studio 2017/2019 的菜单命令.
您可以右键单击项目的 References 节点并选择该命令.从 Browse 选项卡中搜索要在 NuGet 存储库中使用的库,单击找到的项目,然后安装它.(当然,您需要为该 DLL 提供一个包,但不能保证存在)

UPDATE AFTER SOME YEARS
At the present time the best way to resolve all those problems is through the
Manage NuGet packages menu command of Visual Studio 2017/2019.
You can right click on the References node of your project and select that command. From the Browse tab search for the library you want to use in the NuGet repository, click on the item if found and then Install it. (Of course you need to have a package for that DLL and this is not guaranteed to exist)

在此处阅读有关 NuGet 的信息

这篇关于如何在 Visual Studio 中向项目添加 .dll 引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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