How to execute a WiX custom action DLL file with dependencies

Adam Tegen picture Adam Tegen · Oct 20, 2009 · Viewed 14k times · Source

I want to create a CustomAction C# DLL file that depends on a third-party .NET DLL (in this specific case, it's MySql.Data.dll). I have the C# custom action DLL file working with the WiX fragment below. I'm just trying to figure out how to safely add a dependency to the custom action. Note: I don't actually need this third-party DLL file file for the installed application to run.

  <Binary Id="MyCustomAction.dll" SourceFile="MyCustomAction.CA.dll" />

  <CustomAction Id="FixupConfigForMysql" Return="check" />

  <InstallExecuteSequence>
     <Custom Action='FixupConfigForMysql' After='InstallFiles'>NOT Installed</Custom>
  </InstallExecuteSequence>

Do I need to install the third-party DLL file (MySql.Data.dll) in order to get the custom action to run?

Can I just add another Binary tag with the third-party DLL file?

Answer

Rob Mensching picture Rob Mensching · Oct 20, 2009

DTF in the WiX toolset has a mechanism to include your custom action assembly and all of its references into a single binary (self-extracting dll, basically). I don't write managed custom actions (C/C++ creates custom actions with fewer dependencies and increases success rate) but it is supposed to just work when building in VS.