c# - 异常 : system. IO.FileNotFoundException : cannot find assembly or file Mysql. 数据

标签 c# .net mysql runtime-error

当我执行独立程序时,它崩溃并显示:

Exception: System.IO.FileNotFoundException: cannot find assembly or file Mysql.Data  or load one of the dependable sources at project3.class.executesend<> at project3.class.initialize<> at project3.class.main<>

经过一番搜索,我发现我应该将这些 .dll 文件添加为程序的资源。我这样做之后,它产生了同样的错误。

我该如何解决这个问题?

最佳答案

如果我没理解错的话,您在项目的引用文件夹中添加了 Mysql.Data。

现在,在 VS Explorer 中右键单击它,转到属性,并将属性“Copy Local”设置为 true。

因此,每当您构建应用程序时,它都会被复制到“debug”或“release”文件夹中。

关于c# - 异常 : system. IO.FileNotFoundException : cannot find assembly or file Mysql. 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14635497/

相关文章:

c# - 当存在 500 个实时实例时,ColorConvertedBitmap 的构造失败

c# - 在 Unity 中顺畅地逐 block 移动播放器

c# - 如何确定网络响应流的编码?

.net - VB 到 C# 或 VB.net 的转换

c# - AppDomain.CurrentDomain.BaseDirectory 在运行测试后发生变化?

c# - C#语言中关于XML序列化的Arrayname

c# - 检查 AD 中是否存在用户/电子邮件

mysql - 错误 1064 :You have an error in your SQL syntax

php - PDO 多查询 "SQLSTATE[HY000]: General error"

Mysql员工休息时间历史与时差