5

I'm trying to use ILMerge to combine my C# program with 3 referenced DLL's. If I run the program without merging them, everything runs well but when I merge them I get the "Void System.Threading.Monitor.Enter" Error.

Here are the DLL's I am combining:

HTMLAgilityPack.dll
MySql.Data.dll
RKLib.ExportData.dll

The error appears to be coming from the MySql.Data.dll but I am not really sure why it would throw this exception.

Any ideas much appreciated.

EDIT: Full error I am receiving is:

************** Exception Text **************
System.MissingMethodException: Method not found: 'Void System.Threading.Monitor.Enter(System.Object, Boolean ByRef)'.
at MySql.Data.MySqlClient.MySqlConnection.set_ConnectionString(String value)
at MySql.Data.MySqlClient.MySqlConnection..ctor(String connectionString) in :line 0
Reg
  • 555
  • 5
  • 10
  • 26
  • Always add the full error information. Makes it easier to find similar errors. – H H Feb 24 '13 at 18:11
  • 1
    Monitor.Enter(Object, Boolean%) was added in .NET 4.0. Does the merged assembly reference the .NET 4.x assemblies or perhaps an older version? – dtb Feb 24 '13 at 18:19
  • Could you tell me how to check that? I know my program is but I'm not sure how to check if MySql.Data is. – Reg Feb 24 '13 at 18:26
  • 5
    It seems ILMerge targets .NET 3.5 by default if you don't use the target platform option to point to your v4 framework directory. – dtb Feb 24 '13 at 18:28
  • 2
    Well that was Easy! Thanks for your help. If you add as an answer I will accept it. – Reg Feb 24 '13 at 18:32

1 Answers1

1

What version of the framework are you using? There is a targetplatform option you may need to set if you are using 4.0/4.5 for example.

/targetplatform:version,platformdirectory

Sacrilege
  • 795
  • 9
  • 25