我怎样一个程序集添加到Visual Studio项目和参考呢? [英] How do I add an assembly to a Visual Studio project and reference it?

查看:119
本文介绍了我怎样一个程序集添加到Visual Studio项目和参考呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个程序集 MySql.Data.dll ,并想将其添加到一个新的Visual Studio项目。我失去了正确的术语,以及如何最好地去了解这一点,但最终的目标是要分发此DLL,以便它包含的应用程序运行时。这是为了避免在海关总署最终用户的计算机上的DLL。

I've compiled an assembly for MySql.Data.dll and would like to add it to a new Visual Studio Project. I'm lost on the correct terminology and how best to go about this, but the end goal is to distribute this dll so that it's included with the application when the application runs. This is to avoid having to GAC the dll on the end user's machine.

我试着简单地复制装配到项目文件夹:

I've tried simply copying the assembly into the project folder:

不过,我无法弄清楚如何添加一个引用到DLL当前项目。我也没有想出如何保证这个dll会留的应用程序,一旦它被编译。这会如何来完成,我可能会考虑其他什么事情?

However, I can't figure out how to add a reference to that dll in the current project. Nor have I figured out how to ensure that this dll will "stay with" the application once it is compiled. How might this be accomplished and what other things might I consider?

推荐答案

请尝试以下

  • 在参考节点右cilck
  • 选择添加引用
  • 点击浏览标签
  • 在浏览到磁盘上的DLL MySql.Data.dll,点击OK

一旦它的加入,单击参考下的引用文件夹,并按下F4键。这将弹出属性工具窗口。请确保它被设置为复制本地=真。这将确保它得到了标准的安装程序(MSI和ClickOnce的)部署应用程序

Once it's added, click on the reference under the References folder and hit F4. This will bring up the properties tool window. Make sure it is set to "Copy Local" = True. This will ensure it gets deployed with your application by the standard installers (MSI and ClickOnce)

这篇关于我怎样一个程序集添加到Visual Studio项目和参考呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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