0

I have created desktop application using C#, having mysql database. I have installed the mysql connector in order to connect to mysql DB.

when I give the absolute path till project director , I can run the application successfully. However when i copied the .exe file from bin/release folder, application did not work. It needs MySql.Data.dll in the current folder, then only it worked, how we can remove this dependency?

I checked the other properties in reference, like Copy Local = true.

still it is not working.

Futuregeek
  • 1,900
  • 3
  • 26
  • 51
Abhijit
  • 11
  • 1
  • 3
  • in which file did you set the CopyLocal? – hallie Jul 16 '13 at 06:13
  • probably duplicate question http://stackoverflow.com/questions/13965181/conect-mysql-with-mysql-enterprise-dll-message-could-not-load-file-or-assembly/13965377#13965377 – Sean Jul 16 '13 at 06:33

1 Answers1

0

You could potentially install the DLL in the GAC, but personally I wouldn't - it's simpler to deploy an application if it doesn't need any GAC entries. It's entirely normal for a .NET application to require the third-party libraries it uses to be colocated with the executable. You depend on that DLL, so it has to be available somewhere. Either that has to be a central place (the GAC) or alongside the exe file.

I suggest you just copy the DLL along with the executable to wherever you need them.

Another option would be to merge the assemblies with ilmerge, but I'd recommend against it unless you really, really have to. (I have nothing against ilmerge, but I dislike taking any steps away from the simplest deployment model unless I have to.)

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194