views:

193

answers:

3

I am Developing a Desktop 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.

A: 

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

Paul Sasik
A: 

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)

ridecar2
+1  A: 

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

Igor Zelaya