Announcement

Collapse
No announcement yet.

Important if you are using the Newtonsoft DLL in your plugin!

Collapse
This is a sticky topic.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Originally posted by shill View Post
    The exe.config file goes in the HS3 root directory along with your plugin exe file. The private bin folder is for any other DLLs you reference to avoid conflicts with other people using the same DLL but that might not always be the exact same version.
    Perfect! Thanks for the quick answer.

    Comment


    • #32
      Originally posted by rjh View Post
      The following changes need to be made in order for your plugin to function properly with the HS3 version 3.0.0.333 or later.

      If you reference the Newtonsoft JSON DLL in your plugin, make sure you install that dll in your own folder. Lets assume your plugin is named "AcmePlugin", your install.txt should install the Newtonsoft dll to:

      bin\AcmePlugin

      You should then include a exe.config file with the bin path set like so:
      Code:
      <probing privatePath="bin/AcmePlugin;bin" />
      Note, many plugins are including the exe.config file and the bin path, but they are including "bin" before their own path, this is incorrect. Make sure "bin" is added after your private path.
      For this recommendation, where in the XML file structure does this need to be located? I added this to my app.config file in my VS project under the <startup> node but a Windows user had a problem getting the JSON DLL to be found when running the plug-in. Only after he moved the <runtime> section containing the probing statement up under <configuration> in the generated exe.config file did it find the DLL correctly (although I had no problem on my HS3 Windows PC using the exe.config file as it was). So does the probing line fall under <configuration>, <startup> or both? An example that shows more of the file would probably be helpful vs. just the single line.


      My original app.config file (probing just under <startup>)
      Code:
      <?xml version="1.0"?>
      <configuration>
        <system.diagnostics>
          <sources>
            <!-- This section defines the logging configuration for My.Application.Log -->
            <source name="DefaultSource" switchName="DefaultSwitch">
              <listeners>
                <add name="FileLog"/>
                <!-- Uncomment the below section to write to the Application Event Log -->
                <!--<add name="EventLog"/>-->
              </listeners>
            </source>
          </sources>
          <switches>
            <add name="DefaultSwitch" value="Information"/>
          </switches>
          <sharedListeners>
            <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter"/>
            <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
            <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
          </sharedListeners>
        </system.diagnostics>
        <startup>
          <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
          <runtime>
            <loadFromRemoteSources enabled="true" />
            <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
              <probing privatePath="bin/TankUtil" />
            </assemblyBinding>
          </runtime>
        </startup>
      </configuration>


      What he did to make it work and load the Newtonsoft DLL (relocated code in red)

      Code:
      <?xml version="1.0"?>
      <configuration>
      <runtime>
      <loadFromRemoteSources enabled="true" />
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="bin/TankUtil" />
      </assemblyBinding>
      </runtime>
      <system.diagnostics>
      <sources>
      <!-- This section defines the logging configuration for My.Application.Log -->
      <source name="DefaultSource" switchName="DefaultSwitch">
      <listeners>
      <add name="FileLog"/>
      <!-- Uncomment the below section to write to the Application Event Log -->
      <!--<add name="EventLog"/>-->
      </listeners>
      </source>
      </sources>
      <switches>
      <add name="DefaultSwitch" value="Information"/>
      </switches>
      <sharedListeners>
      <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter"/>
      <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
      <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
      </sharedListeners>
      </system.diagnostics>
      <startup>
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
      </startup>
      </configuration>

      Comment


      • #33
        Here is an example form one of my plugins, it goes under configuration/runtime:

        <?xml version="1.0"?>
        <configuration>
        <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <probing privatePath="bin/CpsTuya"/>
        </assemblyBinding>
        </runtime>
        <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
        </startup>
        </configuration>

        Comment


        • #34
          Thank you!

          Originally posted by bsobel View Post
          Here is an example form one of my plugins, it goes under configuration/runtime:

          <?xml version="1.0"?>
          <configuration>
          <runtime>
          <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <probing privatePath="bin/CpsTuya"/>
          </assemblyBinding>
          </runtime>
          <startup useLegacyV2RuntimeActivationPolicy="true">
          <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
          </startup>
          </configuration>

          Comment

          Working...
          X