I'd like to use huysentruitw's SapNwRfc connector to connect to SAP. I have copied all the necessary files to project root (sapnwrfc.dll, icuuc50.dll, icuin50.dll, icudt50.dll) but I still got error when I try to call this:
SapLibrary.EnsureLibraryPresent();
the error I got:
System.BadImageFormatException HResult=0x8007000B Message=An attempt was made to load a program with an incorrect format. (0x8007000B) Source=SapNwRfcDotNet StackTrace: at SapNwRfc.Internal.Interop.RfcInterop.RfcGetVersion(UInt32& majorVersion, UInt32& minorVersion, UInt32& patchLevel) at SapNwRfc.Internal.Interop.RfcInterop.GetVersion(UInt32& majorVersion, UInt32& minorVersion, UInt32& patchLevel) at SapNwRfc.SapLibrary.GetVersion() at SapNwRfc.SapLibrary.EnsureLibraryPresent()
I have tried to changed platform from any CPU to x86 (then I got error from IIS Express), and x64 (the same behavior as any CPU)
Do you have any tips how to handle it?
Thank you.
EDIT
Tested with .NET Framework 4.7.2 and works fine. With Core 2.1, 3.1 and .NET5 does not work.
I have also tried it without copying the files into project folder and result is the same (files are present in System32 and SysWOW64 folders)