I've got a Solution having a Project which utilizes a MSSQL Database and produced with this a VisualStudio setup projekt. I quickly make another project by having an installer class which should deploy my database around the installation.

And So I produced the CustomAction Installer class using this Tutorial as well as attempted this C# Solution that is similar.

When im running now my setup project and wish to install my Application i usually have an error:

While initializing cellular phone an exception happened: System.BadImageFormatException: File or set up ... CustomAction.dll or among its dependencies not found. The set up is placed with a term that's newer compared to presently loaded term, and cannot be loaded.

I really hope the mistake is understandable, i converted it from german to englisch ...

So im grateful for just about any hints or ideas to solve this.


Possibly this information will help: http://msdn.microsoft.com/en-us/library/k7137bfe(VS.80).aspx

There appears to become 2 possible causes:

  1. The DLL path isn't being resolved properly therefore the DLL isn't found. You can test checking the way the DLL relative path is resolved from the working directory.
  2. There's an issue with the custom action. Within this situation you can test developing a log and try to discover more. You may create logs with msiexec.exe, for instance:

msiexec.exe /i package.msi /l*v "C:package.log"

One of the numerous good reasons to not use InstallUtil ( Installer Class ) custom actions may be the are "sticky" if this involves the hosting process and also the version of CLR being jitted. If your 1.1 CA fires a 2. fires it'll fail having a BadImageFormat exception.

I truly reccomend carrying out a good look for WiX Deployment Tools Foundation. It's a far greater hosting model for the handled code and solves the issue and many more.