Moskus/hspi_CsharpSample

Fresh download won't build in VS2017

Closed this issue · 6 comments

After doing a fresh download (3/06/2019), unzipped into a new folder. Opened solution in VS2017. A build attempt yields this error:
Severity Code Description Project File Line Suppression State
Warning There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "HomeSeerAPI", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. hspi_CsharpSample

Fixed that by using Config Manager to change to x86.
Rebuild gives four errors. All in program.cs. Around lines 80 to 86, _ip and _port "does not exist in the current context". These appear to be defined earlier in the program as just ip and port, but I'm new to C# and may not be interpreting the code correctly. In any event, if I change those few lines to use just ip and port, the solution will build. I made no other changes.

After building, copied the exe and pdb files to the HS3 directory. Started HS3 and get the following in the log:
Error, Class not found in plugin EXE, maybe namespace is not correct,? Note filename is case sensitive!: hspi_CsharpSample.exe Class: hspi_CsharpSample.HSPI->

This may just be a newbie error on my part, but I'm stumped.

The ip and port part is correctly an error.
I will test installing the plugin on a server again to check what else is wrong.

Hmm, yes. We have a bug. I have never tried running this plugin locally on a server, only remote. And it works ok remote.
But it should also work locally.
I will look into it.

Until I have found out why it does not work locally I would suggest you take a look at
https://github.com/alexbk66/HSPI_AKTemplate
I know his works locally. Sorry for the inconvenience.

This appears to be a rather common problem. Take a look at all the results you get when you do this search:
site:forums.homeseer.com "Error, Class not found in plugin EXE, maybe namespace is not correct,? Note filename is case sensitive!:"

It appears to have something to do with mixed-case naming, but I don't have a handle on what would have to be changed from a developer's standpoint.

Thanks. I am looking into it and it seems that my code lacks proper casing and a couple of methods that HomeSeer expects when running locally.

Seems like it works as intended after stealing a lot of code from https://github.com/alexdresko/HSPI