Question

I have a Solution with a Project which uses a MSSQL Database and generated for this a VisualStudio setup projekt. Then i have made another project with an installer class that should deploy my database on the installation.

So I generated the CustomAction Installer class using this Tutorial and also tried this C# Solution which is similar.

When im running now my setup project and want to install my Application i always get an error:

While initializing the installation an exception occurred: System.BadImageFormatException: File or assembly ... \ CustomAction.dll or one of its dependencies not found. The assembly is inserted by a term that is more recent than the currently loaded term, and can not be loaded.

I hope the error is understandable, i translated it from german to englisch ...

So im grateful for any hints or tips to solve this.

regards

Was it helpful?

Solution

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

There seems to be 2 possible causes:

  1. The DLL path is not being resolved correctly so the DLL is not found. You can try checking how the DLL relative path is resolved against the working directory.
  2. There is a problem with the custom action. In this case you can try creating a log and see if you can find out more. You can create logs with msiexec.exe, for example:

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

OTHER TIPS

One of the many reasons to not use InstallUtil ( Installer Class ) custom actions is the are "sticky" when it comes to the hosting process and the version of CLR being jitted. If a 1.1 CA fires then a 2.0 fires it'll fail with a BadImageFormat exception.

I really reccomend doing a good search for WiX Deployment Tools Foundation. It's a much better hosting model for your managed code and solves the problem and many others.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top