Could not load file or assembly 'Microsoft.mshtml ... Strong name validation failed

Rabbi picture Rabbi · Jan 14, 2010 · Viewed 48.3k times · Source

I made a WPF/C# program and I am using the internet control for WYSIWYG HTML editing.

it is a regular Executable program.

it works on most computers however some computers are giving me the following error.

Could not load file or assembly 'Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Strong name validation failed.

The 'Microsoft.mshtml.dll' file is distributed with the program. It is with all of the other required dlls in the same folder as the exe file.


Here is the output from Fuslogvw

*** Assembly Binder Log Entry  (1/14/2010 @ 6:36:51 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable  C:\Documents and Settings\office\Desktop\Database\DATABASE.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = CAMPUSREMOTE\office
LOG: DisplayName = Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 (Fully-specified)
LOG: Appbase = file:///C:/Documents and Settings/office/Desktop/Database/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = DATABASE.exe
Calling assembly : ChabadOnCampusMainFrontEnd, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: Start binding of native image Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
WRN: No matching native image found.

Thanks

Answer

Atara picture Atara · Mar 9, 2010

Verify that the 'Microsoft.mshtml.dll' file, distributed with the program is the PIA file and not an Office file. Some sites claims that the Office files are "delay signed" and the PIA file (installed with the VS installation) is a signed copy. on my computer I have 3 different versions of 'Microsoft.mshtml.dll' file, (same file-size, but different content):

  1. "c:\Program Files\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office11\Microsoft.mshtml.dll"

  2. "c:\Program Files\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office12\Microsoft.mshtml.dll"

  3. "c:\Program Files\Microsoft.NET\Primary Interop Assemblies\Microsoft.mshtml.dll"

Remove "Microsoft.mshtml.dll" reference from the project. Use "Add Reference", ".Net" tab, select the PIA file, use "copy loacal" option. (It worked for me . . .)

Atara