The problem is caused by having Any CPU
platform target selected for your app.
This means your app could run as both 32x
and x64
process depending on a .NET runtime bitness executing your app. If your process runs as x64
and you have 32x
DI API installed (or vice versa), you get this issue, since DI API requires loading native DLLs into your process. However, 32x
DLLs couldn't be loaded into a x64
process and vice versa.
That's why we have to explicitly allow the exact same bitness for your app as the DI API bitness it would use.
To do this:
- first, have SAP DI API (
c:\Program Files\SAP\SAP Business One DI API\
) and SAP Business One SDK (c:\Program Files (x86)\SAP\SAP Business One SDK\
) installed - next, figure out which version (x86 or x64) of DI API you have. If it's installed in
c:\Program Files
- you have x64 version and if it's inc:\Program Files (x86)\
- you have x86 one - finally, go to your Project properties -> Build tab and set the same Platform target that your DI SDK version is: