Moskus / hspi_CsharpSample

C# sample for HomeSeer 3 plugins
6 stars 1 forks source link

Getting System.BadImageFormatException when Trying to Build from Fresh Download #6

Closed royf007 closed 5 years ago

royf007 commented 5 years ago

Hi, I'm getting the following exception: System.BadImageFormatException when Trying to Build from Fresh Download. I'm using Visual Studio 2017 Community Edition, have HomeSeer 3.0.0.500 running locally, and I have copied the 3 DLLs from the HomeSeer local installation to the solution lib folder:

Here are the full details:

System.BadImageFormatException: 'Could not load file or assembly 'HomeSeerAPI, Version=1.0.2.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.'

royf007 commented 5 years ago

Ok, it was a noob issue. I solved it by changing the Platform Target to "Prefer 32-bit" on the Solution Properties. Works great now!

HSPI_VS_Build_Fix_20190313

oesolberg commented 5 years ago

Thanks for the heads up. Added explanation to the readme.