Anthony K
Anthony K

Reputation: 2603

How do I set the .NET Framework version used to run a MSIExec Custom Action

I am using WiX to create a MSI that calls a managed Custom Action (CA) written with Votive in VS 2008. The CA targets .NET 32 bit Framework 3.5. When I run the setup it fails loading the CA since it cannot find the right framework version. In the MSI installation log are the lines

MSI (s) (5C:C0) [10:25:00:680]: Hello, I'm your 32bit Impersonated custom action server.
SFXCA: Extracting custom action to temporary directory: C:\Windows\Installer\MSI34ED.tmp-\
SFXCA: Binding to CLR version v4.0.30319

I have worked out that the issue is the wrong framework version is being loaded. It seems to be the inverse problem mentioned when trying to run a version 4 CA and version 2 of the framework is loaded by MSIExec (I assume it is the MSIExec that decides to load the framework).

I have VS 2010 installed on the box as well, but for reasons beyond my control I must use VS 2008 for the project. If I upgrade the project to VS 2010 everything runs as expected, since the CA is then targeted to .NET 4.0.

Is there some way I can get MSIExec to load .NET 2.0/3.5 when calling the Custom Action?

UPDATE: I have changed the CustomAction.config so that it now has
<!--<supportedRuntime version="v4.0" />-->
<supportedRuntime version="v2.0.50727"/>
and it has made no difference.

I have also found that it is the act of trying to load the CA into the debugger that is causing the exception. If I run the msi without breaking on the method, it runs as expected (no errors). SO I can deploy the setup as a .NET 3.5 setup, I just cannot debug the CA.

Upvotes: 0

Views: 1838

Answers (1)

Anthony K
Anthony K

Reputation: 2603

It looks like you cannot override the version of .Net used by MSIExec.
Aaron Stebner's blog entry Don't use managed code to write your custom actions! says:

Also, if you author a managed DLL custom action you leave your fate in the hands of Windows Installer, because it will use the latest version of the .NET Framework on the machine in all cases

Upvotes: -2

Related Questions