Wixsharp: How to use WixQuietExecAction after all files were copied

Created on 12 Nov 2019  路  5Comments  路  Source: oleg-shilo/wixsharp

Trying to execute an installed file at the end of the setup, I tried something like this:

project.Actions = new WixSharp.Action[]
{
    new WixQuietExecAction(
        @"[INSTALLDIR]\adxregistrator.exe",
        @"/install=""MyOutlookAddIn.dll"" /privileges=admin /returnExitCode=false"),

// ...

Which results in a 1603 exit of the setup.

Looking with Process Monitor, it seems that the action is executed _before_ the files were copied.

I then tried:

project.Actions = new WixSharp.Action[]
{
    new WixQuietExecAction(
        @"[INSTALLDIR]\adxregistrator.exe",
        @"/install=""MyOutlookAddIn.dll"" /privileges=admin /returnExitCode=false",
        Return.ignore,
        When.After,
        Step.InstallFinalize,
        Condition.NOT_Installed),

// ...

Which does not change anything. Still seems that the files are not copied at all before calling the custom action.

My question

(How) is it possible to run a just self-copied executable (silently) at the end of the MSI setup?

question

Most helpful comment

Don't be to harsh :)

The name the even is not really ideal. Simply instead of AfterInstall, AfterUninstall, AfterUpgrade and AfterModify I opted to a single event with an event arg indicating the type of the setup session.

Now I think that the name AfterSetup would be semantically a better choice but... it's kind of too late to change the game :)

All 5 comments

Hi Uwe,

I would go with the AfterInstall event. Particularly because it is already elevated and the all files are in place:

C# project.AfterInstall += (SetupEventArgs e)=> { if (e.IsInstalling || e.IsModifying) { var exe = e.InstallDir.PathCombine("adxregistrator.exe"); . . . } };

Thank you, I'll try that.

Any chance to do the same during uninstall, too?

Yep:

C# project.AfterInstall += (SetupEventArgs e)=> { if (e.IsUninstalling) { . . . } };

OMG, shame on me, this is so obvious and logical. Sorry and thanks a thousand times, Oleg!

Don't be to harsh :)

The name the even is not really ideal. Simply instead of AfterInstall, AfterUninstall, AfterUpgrade and AfterModify I opted to a single event with an event arg indicating the type of the setup session.

Now I think that the name AfterSetup would be semantically a better choice but... it's kind of too late to change the game :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

UweKeim picture UweKeim  路  5Comments

meytes picture meytes  路  5Comments

Eagle3386 picture Eagle3386  路  6Comments

ltemimi picture ltemimi  路  5Comments

mgkeeley picture mgkeeley  路  5Comments