I am using C# .Net framework 4.5 XAML application. My XAML application calls a DLL that I then use to make a call to the Total Phasae I2C aardvark_net.dll, which I have a reference in my C# DLL to it. The aardvark_net.dll depends on the aardvark.dll being in the same directory. When I make a call to AardvarkApi.aa_open(0), I get an exception
Exception: The type initializer for 'TotalPhase.AardvarkApi' threw an exception. InnerException = {"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"}
As far as I can tell, this exception happens because the aardvark.dll needs .Net 2.0, which is the reason for the aardvark_net.dll.
When I create a console app, I get the above exception and then I change the framework in my console app to 2.0 and then I do not get the exception and my call to the Aardvark API works. I then change my framework back to 4.5 and it still works. I tried Total Phase support and did not get a reply so I am stuck.
Can someone explain what is happening to make my console app work and why I cannot get my XAML application to work or just help me with the appropriate change to get my XAML application to work?
User contributions licensed under CC BY-SA 3.0