01-06-2012 05:39 PM
I have builded a .NET dll which is a wrapper of the or-tools, http://code.google.com/p/or-tools/, made by google. I import these by "tools->import->.NET controls to pallet->browse" and select the various dll's. When I do this I get the error
Translated from Dutch to English it comes to this:
"System.BadImageFormatException: Can not load file of assembly C:\or-tools\Google.OrTools.ConstraintSolver.dll or one of it dependencies. This assembly is build by a runtime newer then the currently loaded runtime, and can not be loaded. <append><b>System.BadImageFormatException</b>.
My question is why does this error actually occure? Is it mostlikely because I builded it with .NET 4.0? If so, will it help if I build it with .NET 3.5? Or does LabVIEW doesn't support that either? I hope a NI employee can give me some insight :).
The dll can be downloaded at: http://code.google.com/p/or-tools/downloads/list
Solved! Go to Solution.
01-06-2012 10:44 PM
I think the actual problem in your case is more likely to be 32-bit vs 64-bit. Did you download the correct one for your operating system? Or, did you compile a 64-bit version and are running 32-bit LabVIEW (or vice-versa).
01-07-2012 07:17 AM
I'm running 32 bit version. I also downloaded and compiled the 32 bit version... But am I now in the understanding that you downloaded the dll and it worked for you?
01-07-2012 12:42 PM
The intiali guess about .Net 4.0 is probably correct. Although 32 Bit and 64 Bit of course need to match as well on LabVIEw and DLL side, LabVIEW does not yet support .Net 4.0 out of the box. Supposedly you can write a manifest file and place it in the directory where LabVIEW.exe is to force LabVIEW to load with .Net 4.0 anyways but it is a workaround, not a proper solution. Recompiling with .Net 3.x is definitely the better solution if you have the source code of the component and that source code does not make use of .Net 4.0 features.
01-09-2012 06:12 AM
Hmmm well removing all the code so that it compliles on .NET 3.5 would be a job too time expensive for me at the moment. But I'm still wondering if the DLL worked for you guys? Or it didn't as well? If the latter then I just have to wait till LabVIEW supports .NET 4.0 I guess... (which I hope is with the next release???)
01-09-2012 08:08 AM
@WouterG wrote:
But I'm still wondering if the DLL worked for you guys?
It did not. At least not in LabVIEW. I was able to add it as a reference in Visual Studio 2010.
01-09-2012 08:49 AM
Ya okay, in VS 2010 it also works for me... but not in LabVIEW.
01-09-2012 09:44 AM
I only touch .Net if I absolutely can't avoud it. This here doesn't count as such for me. 🙂
01-10-2012 01:54 AM
Hi,
I think that you have your answer but for more info about the .NET 4.0 and LabVIEW you can read the links which are given below.
http://digital.ni.com/public.nsf/allkb/32B0BA28A72AA87D8625782600737DE9?OpenDocument
http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/configuring_clr_version/
Regards,
Hossein
01-10-2012 04:47 AM
That worked! Awesome 🙂