yigolden / OpenSlideNET

.NET bindings for OpenSlide (http://openslide.org/)
MIT License
24 stars 6 forks source link

Windows - An attempt was made to load a program with an incorrect format #44

Closed hubba002 closed 1 year ago

hubba002 commented 1 year ago

I am trying to figure out why OpenSlideNet works on my Windows computer at home in Visual Studio 2019 (web form project), but I cannot get it to work on my Windows computer at work in Visual Studio 2019 (web form project). I get a "An attempt was made to load a program with an incorrect format" which I believe means OpenSlideNet is not finding libopenslide-0.dll. I have my path set and Python, on my computer at work, finds the library fine. I have tried to putting the libopenslide-0.dll in my project \bin folder, but to no avail. I believe I installed OpenSlide and OpenSlideNet the same way at home and work, but I am missing something. If someone can provide advise or Visual Studio installation I would appreciate it.

hubba002 commented 1 year ago

After 2 days of trying to figure this out, I believe I have the answer. First, make sure libopenslide-0.dll is in the DLL path as yigolden says in the instructions. The issue I was having was actually coming from IIS Express (and I assume IIS would behave the same way). Under the project properties, you goto "Web" and set the "Bitness" property for IIS. I set mind to x64 and it now works.

image