3

My C# App has a reference to AvalonWizard dll. The AvalonWizard dll is strongly signed with a PublicKeyToken = 8f2c89e926618269. However, my app when is loading the AvalonWizard dll, is trying to load an assembly with PublicKeyToken = null and therefore there is the following error:

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

I don't understand why my app is trying to load the dll with public key token null, as in the .csproj is referenced the one strongly signed:

<Reference Include="AvalonWizard, Version=1.2.0.0, Culture=neutral, PublicKeyToken=8f2c89e926618269, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\dlls\AvalonWizard.dll</HintPath>
</Reference>

I have checked also the assembly blind log entry, and this is the result:

 *** Assembly Binder Log Entry  (14/08/2018 @ 10:53:09) ***

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

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Users\vicent.rico\Documents\GitHub\KNXPM\TestApp\bin\Debug\TestApp.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = AvalonWizard, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Users/vicent.rico/Documents/GitHub/KNXPM/TestApp/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = TestApp.exe
Calling assembly : PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\vicent.rico\Documents\GitHub\KNXPM\TestApp\bin\Debug\TestApp.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\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:///C:/Users/vicent.rico/Documents/GitHub/KNXPM/TestApp/bin/Debug/AvalonWizard.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Users\vicent.rico\Documents\GitHub\KNXPM\TestApp\bin\Debug\AvalonWizard.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: AvalonWizard, Version=1.2.0.0, Culture=neutral, PublicKeyToken=8f2c89e926618269
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.

Any ideas where else I can check? What I don't understand is why my app is looking for the dll with null public key token.

chincheta73
  • 187
  • 1
  • 22
  • 1
    Possible duplicate of [Could not load file or assembly 'AssemblyName PublicKeyToken=null' or one of its dependencies](https://stackoverflow.com/questions/21435283/could-not-load-file-or-assembly-assemblyname-publickeytoken-null-or-one-of-its) – Hintham Aug 14 '18 at 09:09
  • Hi @Hintham it's true that my problem is the same. However, I couldn't find the solution in that other question. I've been trying to solve this for weeks and I am kind of desperate. – chincheta73 Aug 14 '18 at 09:17
  • Did you try to rebuild your solution (clean and build)? The problem appears to be that it is looking for an unsigned version of the assembly. You may also want to remove the reference and then add it again. – Hintham Aug 14 '18 at 09:22
  • Yes. I've done that several times. – chincheta73 Aug 14 '18 at 09:29
  • Could it be that it's finding an unsigned version of a dependency of that dll and is then trying to load the unsigned version of Avalon to go with that? Is that output from Fuslogvw? Is the PresentationFramework definitely the project you're expecting to load it, or is there possibly a reference in another project to the null version that's hanging around? – Nanhydrin Aug 14 '18 at 12:01
  • My project is not PresentationFramework. I think that's another dll that is using either my project or the AvalonWizard dll. There is no other reference to AvalonWizard in my project. – chincheta73 Aug 14 '18 at 13:33

0 Answers0