473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 5215
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.