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

前端 未结 4 566
时光取名叫无心
时光取名叫无心 2020-12-05 14:26

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

相关标签:
4条回答
  • 2020-12-05 15:15

    Microsoft.mshtml.dll from PIA folder is not signed.
    If you have signed project, you must take version from "Primary Interop Assemblies" folder.


    To do that:

    1. Remove reference to Microsoft.mshtml (if you have one in your project)

    2. Click "Add Reference" and than DO NOT select "Extensions" but "Browse" and point to "C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies" (for .64 bit Machines) - that version is signed.

    3. Edit properties (select microsoft.mshtml reference and press F4) in order to set:

    Embed Interop Types=false
    Copy Local=true


    4. Rebuild your project

    0 讨论(0)
  • 2020-12-05 15:21

    I had this same problem too but my issue was using TFS Build 2008. The hintpath was relative and had to be changed to the exact path. Otherwise during the build it kept picking up the Office mshtml.dll

    <HintPath>..\..\..\..\..\..\..\..\Program Files\Microsoft.NET\Primary Interop Assemblies\Microsoft.mshtml.dll</HintPath>

    <HintPath>C:\Program Files\Microsoft.NET\Primary Interop Assemblies\Microsoft.mshtml.dll</HintPath>
    
    0 讨论(0)
  • 2020-12-05 15:27

    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

    0 讨论(0)
  • 2020-12-05 15:28

    The first step to tracking down this issue is to determine if it's really Mcirosoft.mshtml.dll or one of it's dependencies. The best way to do this is to use fuslogvw to track the assembly load failure. It will provide detailed information about which assembly is failing.

    • http://msdn.microsoft.com/en-us/library/e74a18c4(VS.71).aspx

    Once you deterimen which assembly is failing, please post back with the results.

    EDIT

    That warning message suggests that the operation eventually succeeded. It doesn't appear to have the error in it.

    0 讨论(0)
提交回复
热议问题