开发者

Problem regarding c#.net application communication with MySql

开发者 https://www.devze.com 2022-12-16 09:33 出处:网络
I am Developing a Deskto开发者_如何转开发p Application with c# .net and MySql as Database. It\'s an encryption application which produces an exe file which communicates withMySql to bring some data. I

I am Developing a Deskto开发者_如何转开发p Application with c# .net and MySql as Database. It's an encryption application which produces an exe file which communicates with MySql to bring some data. I am using the MySql.Data.dll for application communication with MySql. When it produces exe there is no MySql.data.dll with it so it throws an error:

Could not load file or assembly 'MySql.Data, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.


Set the Copy Local Attribute of the assembly reference ( MySql.Data.dll ) to true. That makes the reference copy itself to the output directory.


You need to copy the MySql.Data.dll into the same directory where your application will execute. E.g. the runtime folder.

In other words: At some point you had to locate the MySql.Data.dll to use it in your project's client code. Simply find it again and copy it to the runtime folder: /bin/debug for example


You need to do as psasik stated. If you are to redistribute the application then you need to add the dll to the setup project and you can always use an MSBuild task to copy the dll during debugging (or just leave it in the bin\Debug directory)

0

精彩评论

暂无评论...
验证码 换一张
取 消