[wix-users] Using WiX C# custom action from InstallShield

Christopher Painter chrpai at iswix.com
Tue May 21 12:38:23 PDT 2019


Please read my blog article from 2008....

http://blog.iswix.com/2008/05/deployment-tools-foundation-dtf-managed.html


DTF CA's are encapsulated so that as far as Windows Installer (and InstallShield) are concerned they are Type 1 C/C++ style MSI DLL custom actions.   So in InstallShield use the MSI DLL  custom action type and it'll work perfectly.   I've done it many, many, many times.


________________________________
From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Ben Goldberg via wix-users <wix-users at lists.wixtoolset.org>
Sent: Tuesday, May 21, 2019 12:48 PM
To: wix-users at lists.wixtoolset.org
Cc: Ben Goldberg
Subject: [wix-users] Using WiX C# custom action from InstallShield

Hi. I recently learned how to mix WiX with InstallShield to simplify my interaction with the underlying MSI object. By adding these three lines to the bottom of my Visual Studio .csproj file:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /><Import Project="$(WixCATargetsPath)" Condition=" '$(WixCATargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets" Condition=" '$(WixCATargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets') " />

I'm able to compile that file and it generates both a .dll and a .CA.DLL. If I use the latter to invoke a custom action I can much more easily interact with the underlying MSI object (just by using session["VarName"] to get values and session["VarName"] = "Value" to set values. The problem is that it doesn't work consistently. In a small sample project I can get it to work all of the time but in a "real" project I keep getting exceptions trying to invoke the custom method. I typically get "System.BadImageFormatException: Could not load file or assembly 'ClassLibrary1' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."
Has anyone come across this issue and figured out how to overcome it?
Thanks,
Ben


____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/



More information about the wix-users mailing list