cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sandersonpj
Level 5

BadImageFormatException

I have just installed InstallShield 2010. I have taken a working Project (ism) produced using InstallShield 12 and simply rebuild the CDImage using the new version. Apart from a couple of issues (other threads here) the build was successful. However when I install the created CDImage on a separate machine (which accepted the IS12 version no problem) the installation fails:

Error 1001. Exception occurred when initializing the installation. System.BadImageFormatException: The format of the file xxxxx.dll is invalid.

The file xxxx.dll (not its real name) is a piece of code declared to IS as a Custom Action. The code has not been changed in any way between IS12 and IS2010.

The installation then just rolls back and the installation is not made.

(The previous IS12 version was uninstalled prior to starting to install the new version)
Labels (1)
0 Kudos
(2) Replies
sandersonpj
Level 5

I posted this as I found no matches for the BadImageFormat phrase. However after posting I did a search on the Error 1001 which is also part of the message. I found a post with a different underlying error, but the solution there also fixes my problem.
Go to the Component view of the code identified in the error message (xxxx.dll in my example)
Under .NET Settings the value of .NET Installer Class was set to Yes. Changing this value to "No" fixed the problem and my product now installs.

(As to why this "feature" is different between IS 12 and IS 2010 - as a poor user I can only speculate :confused:
0 Kudos
Cary_R
Level 11

Hi There,

BadImageFormatException is what you get when the .Net Framework attempts to load up an executable image (*.exe, *.dll, etc.) that doesn't match what it's expecting. I was going to write out cases I've seen, but Microsoft does a better job here:

http://msdn.microsoft.com/en-us/library/system.badimageformatexception.aspx

Basically, some caveats that are likely:

--Make sure the version of Installutillib.dll that's in your installshield settings matches what's being used to build the assembly.

--Make sure you didn't code anything strange into the install methods. Such as building the assembly on for x64 platform, but then trying to invoke 32 bit libraries or assemblies.

--Lastly, the sanity check. Make sure the file isn't corrupt.

Hopefully one of these will prove to be the problem when the .Net Assembly's installer class gets invoked during installation.
0 Kudos