Using Codebase to load assembly

XSL picture XSL · Dec 18, 2011 · Viewed 10.8k times · Source

Based on this question, I tried using <codebase> to locate an external assembly. Now, when I run the program, I get an error message saying that the private assembly was located outside the appbase. How can I fix this issue? One suggestion I saw said to sign the assembly. I did this, but then my program couldn't find the assembly. When I unsigned it, I get the outside the appbase error. How do I load an assembly that's located elsewhere using <codebase> and not installing to the GAC? (Probing didn't work either and it seems that it still has to be present within the application folder) My config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>

        <assemblyIdentity name="NGameHost"

                          culture="neutral" />
        <codeBase version="1.0.0.0" 
                  href="C:/Program Files/NetworkGame3/api/NGameHost.exe"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

</configuration>

Answer

sq33G picture sq33G · Dec 18, 2011

If the assembly is a private assembly, the codebase setting must be a path relative to the application's directory.

(from MSDN)