Announcement

Collapse
No announcement yet.

How To Reference a .dll Containing Reusable Code From a C# script file?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How To Reference a .dll Containing Reusable Code From a C# script file?

    I am trying to learn how to put re-usable C# code into a .dll file, install that file into the correct location in the HS4 installation directory, then reference that code from within a C# script file.

    The only official documentation I can find says this:
    ---
    Iif you need to add references to other DLL files, use the following syntax to reference a file, this example references the visualbasic DLL:

    The ScriptingReferences INI entry is for vb.net only.

    //css_reference Microsoft.VisualBasic.dll;

    Note that you need the entire string even though it looks like its commented out.
    ---

    This minimal documentation leaves me with all sorts of follow-up questions. I've been Googling now for several hours, and have found all sorts of misinformation it seems, and have not been able to get it to work. I also see numerous posts in this forum about this same problem, but I have not been able to find any post that gives a detailed explanation of how to do this correctly. Will this even work? Some of the posts seem to indicate that it may not even work due to HS4 bugs?

    Please help.

    Questions:

    1. Where do I deply my MyLibrary.dll file on the target HS4 system?
    (HS4) root folder?
    (HS4)/bin folder?
    (HS4)/bin/homeseer folder?
    ... or somewhere else???
    -
    2. From the official documentation above, I understand that to reference MyLibrary.dll with the following statement:

    //css_reference MyLibrary.dll;

    Where do I put this statement? At the top of my script .cs file before the class statement? Or inside of the class statement?

    3. Do I need to put a regular "using MyLibrary;" statement at the top, or as some posts have mentioned, do I also need to put a /css_using MyLibrary.dll; statement?

    A very simple "hello world" type example would be a huge help (which is basically what I'm trying to create here).

    Thanks in advance,

    Brad



Working...
X