Launching a DLL from custom action

Apr 13, 2016 at 7:31 PM
Edited Apr 14, 2016 at 4:19 PM
Do you think we can call a dll within a custom action. Cause I want to send the log files in case the setup fails. Is there a sample that relates to that ? thanks
Apr 14, 2016 at 2:49 AM
If you are talking about an assembly dll then it can be done in a typical .NET way.
  • If the assembly is distributed then reference it at compile time and implement you routine as required.
  • If the assembly is the global one (GAC) then you can do the same but you don't have to distibute it.
If your dll is a native one then you apply the same logic but you will need to use Interop.

As for sample. My always preferred method is a ManagedSetup AfterInstall event, which is btw elevated :
project.AfterInstall += project_AfterInstall;
. . .
static void project_AfterInstall(SetupEventArgs e)
    //do your stuff here
Though Custom Actions may not be the best choice for all cases. Depending on the nature of the failure you custom action may not be called (neither WiX native nor Wix# managed CA). Then you will need to have a process that will monitor the installation and act upon failure. The obvious candidate for this is a bootstrapper, EmbeddeUI or ExternalUI. The samples are included into the distributable package