0
votes

Before you blame me, yes I did search the other threads for possible solutions, I uninstalled the package multiple times, added the dependeny manually in my App.Config file etc.

Im creating a Windows Forms App (.NET Framework), since it includes a Login, I established a connection to a MySql Server. In Debug Mode everything is working perfectly, but when I build the Solution and try to run the .exe File I just get this annoying error everytime:

enter image description here

I want to share this program with my friends, and I dont want them to get this stupid error message nor do I want to send anyone the mysqldata.dll manually..

Is there any way to work around this?

Here a more specifig Error-Message:

System.IO.FileNotFoundException: Die Datei oder Assembly "MySql.Data, Version=8.0.22.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.

1

1 Answers

0
votes

I want to share this program with my friends, and I dont want them to get this stupid error message nor do I want to send anyone the mysqldata.dll manually

Since your application has a dependency on MySql.Data, the program needs to be able to find that DLL on your friend's computer in order to run.

I can think of two three possible options:

  1. Zip up your bin\Release folder and send everything in it (including MySql.Data.dll) to your friend.
  2. Have your friends download and run the MySQL Installer and make sure they select the "Connector/NET" option. This will put the required DLL in the "Global Assembly Cache".
  3. Write and deliver a full-blown Windows installer to install your application and all its dependencies.

Option 3 is probably overkill for what you want to do. Option 2 seems error-prone, requires your friends to install the right components, and will stop working if you ever upgrade your application to MySql.Data 8.0.23. So I'd go with Option 1, even though it requires sending "the mysqldata.dll manually".