1

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.

....

RBT
  • 24,161
  • 21
  • 159
  • 240
tzerb
  • 1,433
  • 1
  • 16
  • 35

2 Answers2

1

On systems that support common language run-time assemblies, the Windows Installer sets the MsiNetAssemblySupport property to the latest version of the .NET Framework version on the user's computer. You can check the MsiNetAssemblySupport property for the version, and then install a higher version if your CA requires it.

Mark Rovetta
  • 691
  • 6
  • 16
  • Thanks for your help. It still doesn't work. I run the installer with logging and MsiNetAssemblySupport property shows it's values as 4.0.30319.1. I've added some of the log detail to the question. – tzerb Dec 11 '12 at 18:16
  • Is this custom action attempting to use [Isolated Components](http://msdn.microsoft.com/En-US/Library/Windows/Desktop/eb5f7088-30e0-4644-813a-c93e6f56ccbf)? I see [RedirectedDLLSupport](http://msdn.microsoft.com/En-US/Library/Windows/Desktop/703489c4-cac4-442c-bd96-d3927491a864) has been set. Perhaps a required dependency is missing. – Mark Rovetta Dec 12 '12 at 18:55
  • There are no dependencies at all. It's a simple class with one public method: class CA { public int Execute(string s, string t) { return 55; }}; I don't think I did anything to set RedirectedDLLSupport. I'm still looking up this and Isolated Components for clues. Thanks for the help! – tzerb Dec 12 '12 at 20:10
  • I think this may not be a Windows Installer issue, you may want to investigate .NET 3/4 backwards compatibility, for example [this SO question](http://stackoverflow.com/questions/2816914/backwards-compatibility-of-net-framework-4) – Mark Rovetta Dec 12 '12 at 20:46
0

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.

tzerb
  • 1,433
  • 1
  • 16
  • 35