472,804 Members | 1,057 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,804 software developers and data experts.

BadImageFormatException with Microsoft.mshtml

Hello,

I have written an application in .NET (C#) which uses some stuff from the
Microsoft.mshtml. Unfortunately some customers reported that they are
missing this DLL. Therefore we now redistribute a copy of the
Microsoft.mshtml-DLL with our installation routine (just copy it into the
application directory). Now the application works on most machines, but on a
couple of machines I get a "BadImageFormatException" (details below).

What could be the reason for this exception? How can I fix it and ensure
that my application can load the DLL? Could it be a version conflict or
policy problem?

Thanks in advance!
Erich

------

System.BadImageFormatException: The format of the file 'Microsoft.mshtml' is
invalid. File name: "Microsoft.mshtml" at [...]

=== Pre-bind state information ===
LOG: DisplayName = Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a (Fully-specified)
LOG: Appbase = C:\MyApp\
LOG: Initial PrivatePath = NULL
Callong assembly: MyApp, Version=1.0.1942.28310, Culture=neutral,
PublicKeyToken=null.
===

LOG: Publisher policy file is not found.
LOG: Host configuration file not found.
LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\confi g\machine.config.
LOG: Post-policy reference: Microsoft.mshtml, Version=7.0.3300.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Attempting download of new URL file:///C:/MyApp/Microsoft.mshtml.DLL.
Jul 21 '05 #1
2 5144
Hi Erich,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you have copy the Microsoft.mshtml
with you app. However, a BadImageFormatException was thrown sometimes. If
there is any misunderstanding, please feel free to let me know.

As far as I know, the MSHTML.DLL file is distributed with many products.
For example, .NET framework 1.1, Internet Explorer 6.0 and so on. So I
assume that the the problem might occur because of the Primary Interop
Assembly Microsoft.mshtml is not installed properly.

Since copying the Microsoft.mshtml with your app doesn't work, I suggest
you try to install the PIA into the GAC using gacutil.exe. By default, the
app will look into GAC for strong named assembly first.

If that still fails, you can try to use the Assembly Binding Log Viewer to
check for the binding failures. Here is the usage of Assembly Binding Log
Viewer.

http://msdn.microsoft.com/library/de...us/cptools/htm
l/cpgrffusionlogviewerfuslogvwexe.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #2
Hi Erich,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you have copy the Microsoft.mshtml
with you app. However, a BadImageFormatException was thrown sometimes. If
there is any misunderstanding, please feel free to let me know.

As far as I know, the MSHTML.DLL file is distributed with many products.
For example, .NET framework 1.1, Internet Explorer 6.0 and so on. So I
assume that the the problem might occur because of the Primary Interop
Assembly Microsoft.mshtml is not installed properly.

Since copying the Microsoft.mshtml with your app doesn't work, I suggest
you try to install the PIA into the GAC using gacutil.exe. By default, the
app will look into GAC for strong named assembly first.

If that still fails, you can try to use the Assembly Binding Log Viewer to
check for the binding failures. Here is the usage of Assembly Binding Log
Viewer.

http://msdn.microsoft.com/library/de...us/cptools/htm
l/cpgrffusionlogviewerfuslogvwexe.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Erich Hofacker | last post by:
Hello, I have written an application in .NET (C#) which uses some stuff from the Microsoft.mshtml. Unfortunately some customers reported that they are missing this DLL. Therefore we now...
3
by: Zürcher See | last post by:
I've wrote an application that use internet explorer to download some html page, to get the document I use the Microsoft.mshtml library. mshtml.IHTMLDocument3...
1
by: Dean Hallman | last post by:
I need to ensure client machine has Microsoft.mshtml installed in the GAC. And if not, deploy it. My app is a Browser Helper Object and depends on mshtml. Initially, I thought I could take care...
3
by: Installutil System.BadImageFormatExcepti | last post by:
I've tried to make a Windows Service using the 2005 C# and when I go to use Installutil it returns with an System.BadImageFormatException error while intializing the installation. I've even gone as...
1
by: bernhard schelling | last post by:
Hi, I'm using Visual C# Express and I'd like to build a project available from http://download.microsoft.com/download/f/2/7/f279e71e-efb0-4155-873d-5554a0608523/WSRP.exe Somehow the Refernce...
4
by: Roger Aikin | last post by:
I've converted a VB6 project to VB.Net 2005. (Actually using vstudio pro 2005). I'm on a machine that also has VB6 and Vstudio.net 2003 on it. The project uses Word, Excel, MapPoint and SqlClient...
0
by: Filippo Bettinaglio | last post by:
Hi all, In the past 3 days I have done some research about Microsoft.mshtml component within .NET 2 framework. I need some clarification/comfermation about the Microsoft.mshtml componet and...
2
by: JM | last post by:
Hi, I have created a windows application which uses Microsoft.mshtml.dll for displaying browser window in the application for showing html. When I am creating a setup program, I have to...
4
by: =?Utf-8?B?aWduaGVucnk=?= | last post by:
I have mixed-mode multi-file assembly of several netmodules and a dll. All are generated using c# compiler, vc++ compiler and vc++ linker from command prompt. I can browse the content of the...
3
by: John A Grandy | last post by:
VS2005 ( all updates ) on XP ( all updates ) I have a solution with many projects and a substantial reference tree. I have a Windows Application project that will build but not run. It fails...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.