Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Codebase to load assembly

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>
like image 683
XSL Avatar asked Dec 18 '11 17:12

XSL


1 Answers

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

(from MSDN)

like image 85
sq33G Avatar answered Nov 09 '22 04:11

sq33G