Unsigned .NET app fails after field upgrade to signed assembly dependency

By Dave

I have an unsigned test application MyApp that references an unsigned DLL MyDll. I recently signed MyDll and want to test it against MyApp in the field, but the application no longer runs. I do this by merely overwriting MyDll. I do not want to have to recompile MyApp.

Fusion log viewer proves that the issue is with the mismatched public key:

LOG: Assembly Name is: MyDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=abcd1234abcd1234
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

In the past, I have dealt with version mismatches by creating a config file, e.g. MyApp.exe.config, with an entry like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <publisherPolicy apply="no" />
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="MyDll" publicKeyToken="abcd1234abcd1234" culture="null" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="1.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

In this particular case, the version number didn’t change, but I left it in there for testing.

This clearly doesn’t improve anything. Fuslogvw confirms that my config file was loaded when I executed MyApp. Is there another configuration element to add to my config file that will allow my unsigned app to use a signed DLL?

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273