My current target framework is .NET Framework v4.0.
I'm having issues importing the DLL as I get the "BadImageFormatException" similar to this post BadImageFormatException when loading 32 bit DLL, target is x86
From there I realised that the DLL (retrieved from NuGet) can only be built in x64, but my solution can only be x86 as that is what the team has decided on. So I can't change the configuration to x64.
I'm currently using P/Invoke to import it (DllImport). My machine is x64. For context, this DLL is built with managed native c++ code and I am trying to convert it to c#. I cannot touch the dll as it is not my library, but my project is in c#.
Since I am not allowed to change my project settings, and the DLL can only be built in and run in x64, is there any other way to solve this issue?
You can not load a 64-bit dll in a 32-bit process. Your options are: