Question

So, I know there have been a lot of questions similar to this, but I've poured through many answers over the past day and nothing has helped.

I'm developing a WPF application that is referencing a bunch of external DLLs. There is one DLL in particular, called DefinitionInterpreter, which has proven to cause trouble. In every project I reference it in, it is stubborn and chooses not to work. I was able to get it to work in my unit test suite, however, I cannot, try as I may, get it to work in my WPF application.

I have tried GAC, cleaning my project, adding it and removing it, restarting, checking the version, checking the dependencies, and nothing works.

I keep getting the same exception:

Could not load file or assembly 'DefinitionInterpreter, Version=3.6.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I have tried opening the DLL in ildasm.exe and it didn't show anything unusual. It's only dependencies are System.Xml, System.Core, and mscorlib.

When I check the manifest, it verifies that the version is 3.6.0.0

The thing that really gets me is that it works in one of my projects, but I can't get it to work in another, even though they are referencing the same DLL (same path and everything).

Any suggestions? I am using .NET 4.0 (it is a project requirement that it is 4.0) and have tried both x86 and x64.

Edit:

After viewing Fusion Log details, I get this as output:

*** Assembly Binder Log Entry  (7/18/2013 @ 7:07:42 PM) ***

The operation failed.
Bind result: hr = 0x80131040. No description available.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable  E:\Src\Hermes\Tool\bin\Debug\HermesClient.vshost.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = DefinitionInterpreter, Version=3.6.0.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///E:/Src/Hermes/Tool/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = HermesClient.vshost.exe
Calling assembly : SomeAssembly, Version=13.5.13.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: E:\Src\Hermes\Tool\bin\Debug\HermesClient.vshost.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///E:/Src/Hermes/Tool/bin/Debug/DefinitionInterpreter.DLL.
LOG: Assembly download was successful. Attempting setup of file: E:\Src\Hermes\Tool\bin\Debug\DefinitionInterpreter.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: DefinitionInterpreter, Version=3.6.0.0, Culture=neutral, PublicKeyToken=75a99a2a5bcd4c96
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.

The reference in my CSProj is as follows:

    <Reference Include="DefinitionInterpreter, Version=3.6.0.0, Culture=neutral, PublicKeyToken=75a99a2a5bcd4c96, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\DefinitionInterpreter.dll</HintPath>
      <Private>True</Private>
    </Reference>

When I perform the command sn -T DefinitionInterpreter.dll I get 75a99a2a5bcd4c96. I'm honestly at a loss how at runtime it thinks the public key token is null and why there is a mismatch.

Was it helpful?

Solution

So from the log it looks like "SomeAssembly" is linked to non-signed version of that DLL, but all local versions are signed.

If you build "SomeAssembly" yourself - check if reference to "DefinitionInterpreter" points to signed version, otherwise double check with ILDasm that "SomeAssembly" indeed refers to non-signed version and ask owner to provide another version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top