471,339 Members | 1,231 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,339 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 5036
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Erich Hofacker | last post: by
3 posts views Thread by Zürcher See | last post: by
1 post views Thread by Dean Hallman | last post: by
3 posts views Thread by Installutil System.BadImageFormatExcepti | last post: by
1 post views Thread by bernhard schelling | last post: by
4 posts views Thread by =?Utf-8?B?aWduaGVucnk=?= | last post: by
3 posts views Thread by John A Grandy | last post: by

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.