1

I have a .NET library (dll) of helper methods specific to installing my product, that targets .NET 4.

However, the "main" WIX project is targeting .NET 3.5 (as specified in the documentation) (meaning it runs on the 2.0 runtime). It has custom actions that call into the above 4.0 dll.

When running the generated MSI, i get "BadImageFormat" exceptions, when the WIX runtime (running on 2.0 runtime) tries to load my 4.0 dll.

If I had direct access to a .NET 3.5 .exe, I could convince it to load a 4.0 dll by using the trick in its app.config.

However, the WIX runtime is loaded (by msiexec), as far as I can tell from the stack trace, through Interop.

Does anybody have a suggestion on how I could get this to run?

PS. I also tried making the "main" Wix project target 4.0 directly instead of 3.5, but then my setup dialogs will just fail to show.

Cristian Diaconescu
  • 34,633
  • 32
  • 143
  • 233

2 Answers2

1

I don't know how you have this setup in wixsharp, but in Visual Studio WiX has a project template for C#/DTF custom actions. It automatically includes a CustomAction.config that you can use to put SupportedRuntime elements in to achieve what you are trying to do.

Take a look at WIX and Custom Actions

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
0

The BadImageFormat exception means that you are attempting a cross architecture call somewhere in your calling sequence, 32-bit to 64-bit or vice versa. That might be a consequence of getting the incorrect framework, but not necessarily!

PhilDW
  • 20,260
  • 1
  • 18
  • 28
  • It can also mean you are trying to mix CLR versions. I used to see this all the time with InstallUtil CA's where some where compiled for 1.1 and some were 2.0. – Christopher Painter Sep 11 '15 at 19:46