Search code examples
windows-installerinstallshield

CLR Version for Custom Action


I have an InstallShield 2010 basic MSI install with a managed code .dll custom action installed with the application. The custom action works if I build it with .NET 3.5 but it fails if I build it with 4.0.

I see references to setting the CLR version in the manual but I'm at a loss on how to actually do it in the MSI.

All help is appreciated.

Edit 1:

I ran a simple MSI that runs a CA build with .NET version 4, here are a few interesting things picked out of the log:

Property(S): RedirectedDllSupport = 2

Property(S): MsiWin32AssemblySupport = 5.1.2600.5512

Property(S): MsiNetAssemblySupport = 4.0.30319.1

....

MSI (c) (0C:10) [12:12:15:689]: Connected to service for CA interface.

InstallShield: Loaded CLR successfully

InstallShield: Loading Assembly [#v4.dll]

InstallShield: Resolving assembly filekey [#v4.dll].

InstallShield: - Resolved to C:\Program Files\My Company Name\My Product Name\V4.dll

InstallShield: Loading assembly from path C:\Program Files\My Company Name\My Product Name\V4.dll

InstallShield: Unable to load managed custom action assembly [#v4.dll]: Could not load file or assembly 'file:///C:\Program Files\My Company Name\My Product Name\V4.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

Action ended 12:12:15: v4Test. Return value 3.

....


Solution

  • I couldn't make this work with a 'Managed Assembly' in InstallShield. I'm still using InstallShield for the installation but I'm using a WiX DTF (Deployment Tools Foundation) custom action and it works well across versions.