wxs file
<Dialog Id="InputParameters" Width="370" Height="270" Title="!(ll.MyDlg_Title)">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" >
<Publish Event="DoAction" Value="ValidateParameters" >1</Publish>
</Control>
<Dialogue>
<CustomAction Id="ValidateParameters" BinaryKey="my_dll.CA.dll" DllEntry="ValidateParametersFunc" Execute="immediate" />
CustomAction.cs file
[CustomAction]
public static ActionResult ValidateParametersFunc(Session session)
{
session.log("perform validation");
return ActionResult.Success;
}
CustomAction.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
<supportedRuntime version="v2.0.50727"/>
<configuration>
I am trying to execute a validation function when user clicks on Next Button on InputParameters Dialogue.
My all other custom actions work find which are included in InstallExecuteSequence.
If I use a VBScript to display a popup using following customAction instead of above function ValidateParametersFunc then that works fine.
<CustomAction Id="ValidateEnrollmentParameters" Script="vbscript" Execute="immediate"> <!CDATA[msgbox "You clicked?"]]></CustomAction>
But I want to execute the function ValidateParametersFunc.
I am getting error:
Action 18:58:13: ValidateParametersFunc.
Action start 18:58:13: ValidateParametersFunc.
MSI (c) (C4:20) [18:58:13:233]: Invoking remote custom action. DLL: C:\Users\MyUser\AppData\Local\Temp\2\MSI8187.tmp, Entrypoint: ValidateParametersFunc
MSI (c) (C4:A4) [18:58:13:236]: Cloaking enabled.
MSI (c) (C4:A4) [18:58:13:236]: Attempting to enable all disabled privileges before calling Install on Server
MSI (c) (C4:A4) [18:58:13:236]: Connected to service for CA interface.
Action ended 18:58:13: ValidateEnrollmentParameters. Return value 3.
MSI (c) (C4:04) [18:58:13:807]: Note: 1: 2205 2: 3: Error
MSI (c) (C4:04) [18:58:13:807]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 2896
DEBUG: Error 2896: Executing action ValidateParametersFunc failed.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2896. The arguments are: ValidateParametersFunc, ,
Target framework for CustomActions project is : v4.6.1
Can someone please help?
I have tried everything given on the internet but still not able to figure out how to fix this.
Related
I am using Wix 3.11.1 with VS2017 Extension. I set a property from a control on a custom Dialogue and then try to execute an immediate custom action. When I try to read the session, it is always empty.
As recommended I changed my action to differed execution and used an immediate action to set my property. When I run my installer I get the error: "DEBUG: Error 2896: Executing action [ActionName] failed."
In CustomDialog.wxs
<Control Id="ConnId" Type="Edit" X="60" Y="110" Height="17" Width="300" Property="CONN"/>
<Control Id="installButton" Type="PushButton" Text="Continue" Height="15" Width="60" X="240" Y="260">
<Publish Event="DoAction" Value="RegistrationInfoCustomAction">1</Publish>
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Fragment>
<Binary Id="CustomActionBinary" SourceFile="..\..\CustomActions\bin\Debug\CustomActions.CA.dll"/>
<CustomAction Id="SetPropertyForShowProperty" Property="RegistrationInfoCustomAction" Execute="immediate" Value="[CONN]" Return="check" />
<CustomAction Id="RegistrationInfoCustomAction" BinaryKey="CustomActionBinary" DllEntry="SaveUserInfo" Execute="deferred" Return="check" HideTarget="no"/>
</Fragment>
In Product.wxs
<InstallExecuteSequence>
<Custom Action="SetPropertyForShowProperty" After="InstallInitialize"/>
<Custom Action="RegistrationInfoCustomAction" Before="InstallFinalize"/>
</InstallExecuteSequence>
In CustomActions.cs
[CustomAction]
public static ActionResult SaveUserInfo(Session session)
{
Debugger.Launch();
CustomActionData data = session.CustomActionData;
session.Log("Begin SaveUserInfo");
var connectionString = data["CONN"];
session.Log($"content: {connectionString}");
session.Log("End SaveUserInfo");
return ActionResult.Success;
}
The custom action works when it contains only logging statements but adding any other code make it fail. Also, the session is always empty.
In Installer Log:
MSI (c) (88:34) [16:30:21:255]: Invoking remote custom action. DLL: C:\Users\Andre\AppData\Local\Temp\MSIF1A3.tmp, Entrypoint: SaveUserInfo
MSI (c) (88:F8) [16:30:21:256]: Cloaking enabled.
MSI (c) (88:F8) [16:30:21:256]: Attempting to enable all disabled privileges before calling Install on Server
MSI (c) (88:F8) [16:30:21:256]: Connected to service for CA interface.
Action ended 16:30:41: RegistrationInfoCustomAction. Return value 3.
DEBUG: Error 2896: Executing action RegistrationInfoCustomAction failed.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2896.
The arguments are: RegistrationInfoCustomAction, ,
Action ended 16:30:41: SetupDialog. Return value 3.
MSI (c) (88:8C) [16:30:41:911]: Doing action: FatalError
Similar Answers: I want to add some linkes to previous answers on the topic of deferred mode custom actions. There are links to github-samples in these answers - including one sample which uses the DTF class CustomActionData to easily send properties to deferred mode (once you are properly set up):
How to hide the value of customactiondata in logs of MSI?
Pass ConnectionString to Custom Action in WiX Installer (escape semicolon)
UPDATE: It is late, I didn't see this on first sight, but only immediate mode custom actions can be run from the setup GUI. Make a new, immediate mode custom action to set a value to your PUBLIC property CONN, and then set the value of CONN via a type 51 custom action to be assigned to the Id of the deferred mode custom action - as described below.
SecureCustomProperties: Add the property you specify to SecureCustomProperties by setting the Secure="yes" attribute:
<Property Id="MYPROPERTY" Secure="yes">Send this text to deferred mode</Property>
Name Match: the property name you assign the value to must match the deferred mode custom action Id. Looks OK in your source.
More Technical: the Property attribute's value of the type 51 action must be identical to the Id of the custom action that is consuming CustomActionData:
<!-- Declare property with value -->
<Property Id="MYPROPERTY" Secure="yes">Send this text to deferred mode</Property>
<!-- Type 51 CA: Send value of MYPROPERTY to the deferred mode CA named MyAction -->
<CustomAction Id="MyAction.SetProperty" Return="check" Property="MyAction" Value="[MYPROPERTY]" />
<!-- The deferred mode custom action -->
<CustomAction Id="MyAction" Return="check" Execute="deferred" BinaryKey="CAs" DllEntry="MyAction" />
<!-- ... -->
<!-- Inserting the CAs in sequence -->
<InstallExecuteSequence>
<Custom Action="MyAction.SetProperty" After="InstallInitialize" />
<Custom Action="MyAction" Before="InstallFinalize" />
</InstallExecuteSequence>
Here are some resources:
How to pass CustomActionData to a CustomAction using WiX?
https://www.firegiant.com/wix/tutorial/events-and-actions/at-a-later-stage/
How to access installer properties from deferred custom actions
Accessing or Setting Windows Installer Properties Through Deferred, Commit, and Rollback Custom Actions
Getting CustomActionData in deferred custom action
Just for debugging reference. And you can use: string data = session["CustomActionData"];
Tell you what, let me slide in the code to test using VBScript so you can use message boxes. Should not be necessary, just in case you have a debugging issue:
VBScript "Simple.vbs" (save as file):
MsgBox Session.Property("CustomActionData")
WiX markup change:
<Binary Id='Simple.vbs' SourceFile='Simple.vbs' />
<CustomAction Id="MyAction" Return="check" Execute="deferred" BinaryKey="Simple.vbs" VBScriptCall='' />
Just in case that is easier. Recommend you use VBScript for debugging only. I like VBScript to get a "heartbeat" when I want to eliminate all other error sources.
I want to trigger some custom action by clicking some button.
I get return value 1 but the custom action did not run.
This is my log:
Action start 17:09:39: CA1.
MSI (c) (08:00) [17:09:39:220]: Invoking remote custom action. DLL: C:\Users\ARKADY~1\AppData\Local\Temp\MSI87D6.tmp, Entrypoint: CustomAction1
MSI (c) (08:EC) [17:09:39:222]: Cloaking enabled.
MSI (c) (08:EC) [17:09:39:223]: Attempting to enable all disabled privileges before calling Install on Server
MSI (c) (08:EC) [17:09:39:224]: Connected to service for CA interface.
Action ended 17:09:39: CA1. Return value 1.
My custom action is:
[CustomAction]
public static ActionResult CustomAction1(Session session)
{
session.Log("Begin CustomAction1");
return ActionResult.Success;
}
As you can see no "Begin CustomAction1" entry in the logs.
My custom action Config:
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
From wix code declaring CA:
<Binary Id="CA" SourceFile="$(var.CustomAction1.TargetDir)$(var.CustomAction1.TargetName).CA.dll" />
<CustomAction Id="CA1" BinaryKey="CA" DllEntry="CustomAction1" Execute="immediate" Return="check"/>
UI binding:
<Control Id="ManualUpdateButton" Type="PushButton" X="14" Y="188" Width="95" Height="17" Text="Manual Update">
<Publish Event="DoAction" Value="CA1" Order="1">1</Publish>
</Control>
The custom action is running, it's just not logging anything. That's a limitation in MSI -- you can't write to the log from a custom action invoked by DoAction in the UI.
We are using WIX 3.10 to create web applications under default website, this implementation works fine but the issue is with uninstall of the product that it does not remove the web application under the default website.
The Website port and name are entered by user as part of custom dialog which are stored in respective properties.further during uninstall these properties are restored using wix toolset remember property http://robmensching.com/blog/posts/2010/5/2/the-wix-toolsets-remember-property-pattern/ which sets the web application property during uninstall, but still the application is not removed on uninstall.
Uninstall log that sets the website properties after Appsearch:
Action start 15:17:04: AppSearch.
MSI (s) (24:64) [15:17:04:657]: Note: 1: 2262 2: Signature 3: -2147287038
MSI (s) (24:64) [15:17:04:657]: PROPERTY CHANGE: Modifying WEBSITEPORTPROPERTY property. Its current value is 'WEBSITEPORT'. Its new value: '80'.
MSI (s) (24:64) [15:17:04:657]: Note: 1: 2262 2: Signature 3: -2147287038
MSI (s) (24:64) [15:17:04:657]: PROPERTY CHANGE: Modifying WEBSITEPROPERTY property. Its current value is 'WEBSITE'. Its new value: 'Default Web Site'.
<Fragment>
<iis:WebSite Id="SITE" Description="[WEBSITE]">
<iis:WebAddress Id="AllUnassigned" Port="[WEBSITEPORT]"/>
</iis:WebSite>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="TestAppPool" Guid="GUID" KeyPath="yes" Permanent="yes">
<iis:WebAppPool Id="TestAppPool"
Name="Test Net 4.0"
Identity="applicationPoolIdentity"
ManagedPipelineMode="Integrated"
ManagedRuntimeVersion="v4.0" />
</Component>
<Component Id="IIS.Component" Guid="GUID" KeyPath="yes" Permanent="no" Win64="yes">
<iis:WebVirtualDir Id="VirtualDir" Alias="[APPLICATION_NAME]" Directory="Dir" WebSite="SITE" >
<iis:WebApplication Id="Application" Name="[APPLICATION_NAME]" WebAppPool="TestAppPool"/>
</iis:WebVirtualDir>
<RegistryValue Root='HKLM' Key='SOFTWARE\Test\Prod' Name='Website' Value='[WEBSITE]' Type='string' Action='write' />
<RegistryValue Root='HKLM' Key='SOFTWARE\Test\Prod' Name='WebsitePort' Value='[WEBSITEPORT]' Type='string' Action='write' />
<RegistryValue Root='HKLM' Key='SOFTWARE\Test\Prod' Name='Application' Value='[APPLICATION_NAME]' Type='string' Action='write' />
</Component>
</DirectoryRef>
</Fragment>
There is another issue related, repair operation through Add Remove Programs throws a Fatal error with the following error:
WriteIIS7ConfigChanges: Entering WriteIIS7ConfigChanges in C:\Windows\Installer\MSICDDF.tmp, version 3.10.3007.0
WriteIIS7ConfigChanges: Custom action data hash: 41034C345A4E6B9B4DDB8490C1BC5266637BC0E8
WriteIIS7ConfigChanges: CustomActionData WriteIIS7ConfigChanges length: 225
WriteIIS7ConfigChanges: Error 0x80070002: Site not found for create application
WriteIIS7ConfigChanges: Error 0x80070002: Failed to configure IIS application.
WriteIIS7ConfigChanges: Error 0x80070002: WriteIIS7ConfigChanges Failed.
Any other alternative solution that would solve the issue?
I have following .wxs-file:
<?xml version="1.0" encoding="UTF-8"?>
<?define ProductVersion="x.x.x.x" ?>
<?define UpgradeCode="{**MYGUID**}" ?>
<?define Manufacturer="My Company" ?>
<?define ProductName="My Product" ?>
<?define SkuName="MyProduct" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="$(var.ProductName)"
Language="1033"
Version="$(var.ProductVersion)"
Manufacturer="$(var.Manufacturer)"
UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="301"
Compressed="yes"
InstallPrivileges="elevated"
InstallScope="perMachine"
Platform="x86" />
<Media Id="1"
Cabinet="$(var.SkuName).cab"
EmbedCab="yes" />
<Directory Id="TARGETDIR"
Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="ManufacturereDirectory"
Name="$(var.Manufacturer)">
<Directory Id="ProductDirectory"
Name="$(var.ProductName)" />
</Directory>
</Directory>
</Directory>
<ComponentGroup Id="MainComponentGroup">
<Component Directory="ProductDirectory">
<File Name="$(var.MyProject.TargetFileName)"
Source="$(var.MyProject.TargetPath)"
KeyPath="yes"
Vital="yes" />
<ServiceInstall Id="SeviceInstall"
Name="$(var.ProductName)"
DisplayName="$(var.ProductName)"
Type="ownProcess"
Interactive="no"
Start="auto"
Vital="yes"
ErrorControl="normal"
Account="LOCALSYSTEM">
</ServiceInstall>
<ServiceControl Id="ServiceControl_Start"
Name="$(var.ProductName)"
Start="install"
Wait="no" />
<ServiceControl Id="ServiceControl_Stop"
Name="$(var.ProductName)"
Stop="both"
Remove="uninstall"
Wait="yes" />
</Component>
</ComponentGroup>
<Feature Id="MainFeature"
Level="1">
<ComponentGroupRef Id="MainComponentGroup" />
</Feature>
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Property="UPGRADEFOUND"
Minimum="0.0.0.1" IncludeMinimum="yes"
Maximum="$(var.ProductVersion)" IncludeMaximum="yes"
OnlyDetect="no"
IgnoreRemoveFailure="yes"
MigrateFeatures="yes"/>
</Upgrade>
<CustomAction Id="ServiceRestarter"
Directory="ProductDirectory"
ExeCommand=""[SystemFolder]sc.exe" failure "$(var.ProductName)" reset= 60 actions= restart/0"
Impersonate="no" />
<InstallExecuteSequence>
<InstallExecute Before="RemoveExistingProducts" />
<RemoveExistingProducts Before="InstallFinalize" />
<Custom Action="ServiceRestarter" After="InstallFinalize"><![CDATA[NOT Installed]]></Custom>
</InstallExecuteSequence>
</Product>
</Wix>
Before that, I've tried:
<CustomAction Id="ServiceRestarter"
Property="QtExecCmdLine"
Value='"[SystemFolder]sc.exe" failure "$(var.ProductName)" reset= 60 actions= restart/0' />
which apparently called sc.exe - but changed nothing ...
Before that I've tried:
<ServiceInstall Id="SeviceInstall"
Name="$(var.ProductName)"
DisplayName="$(var.ProductName)"
Type="ownProcess"
Interactive="no"
Start="auto"
Vital="yes"
ErrorControl="normal"
Account="LOCALSYSTEM">
<ServiceConfig Id="ServiceConfig"
DelayedAutoStart="yes"
OnInstall="yes"
OnReinstall="yes"
OnUninstall="no"
FailureActionsWhen="failedToStopOrReturnedError" />
<ServiceConfigFailureActions Id="ServiceRestarter"
OnInstall="yes"
OnReinstall="yes"
OnUninstall="no"
ResetPeriod="0">
<Failure Action="restartService" Delay="0" />
<Failure Action="restartService" Delay="0" />
<Failure Action="restartService" Delay="0" />
</ServiceConfigFailureActions>
</ServiceInstall>
which did not work, as the MsiServiceConfigFailureActions table does not work if using an installer < 5.0, and even if using InstallerVersion="500" the only thing I get is an error:
Serivce 'My Product' (My Product) could not be configured. This could
be a problem with the package or your permissions. Verify that you
have sufficient privileges to configure system services.
(and yes, ... I've tried InstallPrivilges="elevated" also - but ... the real issue is Action="restartService" according to this)
So ... using a CustomAction is the way to go (or not?).
I have following output of the log
MSI (s) (34:28) [13:56:46:914]: Note: 1: 1722 2: ServiceRestarter 3: C:\Program Files (x86)\My Company\My Product\ 4: "C:\Windows\SysWOW64\sc.exe" failure "My Product" reset= 60 actions= restart/0
MSI (s) (34:28) [13:56:46:914]: Note: 1: 2205 2: 3: Error
MSI (s) (34:28) [13:56:46:914]: Note: 1: 2228 2: 3: Error 4: SELECT Message FROM Error WHERE Error = 1722
MSI (c) (2C:0C) [13:56:46:914]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
Error 1722. There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor. Action ServiceRestarter, location: C:\Program Files (x86)\My Company\My Product\, command: "C:\Windows\SysWOW64\sc.exe" failure "My Product" reset= 60 actions= restart/0
MSI (s) (34:28) [13:56:48:849]: Note: 1: 2205 2: 3: Error
MSI (s) (34:28) [13:56:48:849]: Note: 1: 2228 2: 3: Error 4: SELECT Message FROM Error WHERE Error = 1709
MSI (s) (34:28) [13:56:48:849]: Product: My Product -- Error 1722. There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor. Action ServiceRestarter, location: C:\Program Files (x86)\My Company\My Product\, command: "C:\Windows\SysWOW64\sc.exe" failure "My Product" reset= 60 actions= restart/0
Action ended 13:56:48: ServiceRestarter. Return value 3.
Action ended 13:56:48: INSTALL. Return value 3.
Can anybody help me out?
edit
I've used the old ServiceConfig-extension:
<util:ServiceConfig xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
FirstFailureActionType="restart"
SecondFailureActionType="restart"
ThirdFailureActionType="restart"
ResetPeriodInDays="1"
RestartServiceDelayInSeconds="20" />
which gives me a following build-error:
error CNDL0200: The ServiceInstall element contains an unhandled
extension element 'util:ServiceConfig'. Please ensure that the
extension for elements in the
'http://schemas.microsoft.com/wix/UtilExtension' namespace has been
provided.
I know that I can resolve this error by using -ext WixUtilExtension via commandline - but I want to use Visual Studio for building ... So how can I adapt the build-command?
Only chance is to add a reference to WixUtilExtension.dll to my project.
I can see that you've only tried the ServiceConfig element, which came with MSI 5.0. However, there's another ServiceConfig element in UtilExtension, which has been there for a long time and it seems that the thread you mention in your question confirms that it works.
The util:ServiceConfig element contains 3 parameters you'd like to use: FirstFailureActionType, SecondFailureActionType and ThirdFailureActionType, all accepting the same enumeration of values - none, reboot, restart and runCommand.
Try it out and if it works, it is far better choice than a custom action.
For WIX V 4.0, building with VS2015, the following works:
1: Ensure that WixUtilExtension.dll assembly is referenced by WIX project.
2: Add http://wixtoolset.org/schemas/v4/wxs/util ns to root Wix element. Note that this is the correct NS for WIX 4.0 (NOT http://schemas.microsoft.com/wix/UtilExtension as for previous versions).
<Wix
xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"
>
3: Ensure that ServiceConfig element is prefixed with correct namespace reference.
<ServiceInstall
Id="MyService"
Type="ownProcess"
Name="MyService"
DisplayName="MyService"
Description="My Service"
Start="auto"
Account="[SERVICEACCOUNT]"
Password="[SERVICEPASSWORD]"
ErrorControl="normal"
>
<util:ServiceConfig
FirstFailureActionType='restart'
SecondFailureActionType='restart'
ThirdFailureActionType='restart'
RestartServiceDelayInSeconds='30'
ResetPeriodInDays='1'/>
</ServiceInstall>
In Visual Studio, to avoid using -ext in CLI you may do the following:
Of course, you add a resource: <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
then, in Solution Explorer -> References -> Add..
WixUtilExtension.dll
After that everything works like a charm.
(wix 3.10)
Of course, if you do use the second ServiceConfig from utils. Like <util:ServiceConfig blablabla
I've managed to get WIX to launch my application on exit, but not sure how to schedule two custom actions using the WixShellExecTarget property.
One CA is to launch an app and the other is a web page based on a url from another CA. These are both launched if the appropriate checkboxes are checked.
<!-- Custom action for executing app -->
<Property Id="WixShellExecTarget" Value="[#Application.exe]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<!-- Custom action for executing Webbrowser -->
<Property Id="???" Value="[CONFIGWIZARDURL]" />
<CustomAction Id="LaunchConfigWizard" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
Any help you could give me to get this working would be greatly appreciated.
Cheers,
Jamie
[Edit] I've tried the suggestion below and I don't get it setting the appropriate value for the second action. It doesn't go to www.google.com as I suggest:
<Publish Dialog="MyExitDialog" Control="Finish" Event="DoAction" Value="SetExec1"><![CDATA[NOT Installed]]></Publish>
<Publish Dialog="MyExitDialog" Control="Finish" Event="DoAction" Value="DoExec"><![CDATA[LAUNCHCAPTURE = "1" AND NOT Installed]]></Publish>
<Publish Dialog="MyExitDialog" Control="Finish" Event="DoAction" Value="SetExec2"><![CDATA[NOT Installed]]></Publish>
<Publish Dialog="MyExitDialog" Control="Finish" Event="DoAction" Value="DoExec"><![CDATA[LAUNCHCONFIGWIZARD = "1" AND NOT Installed]]></Publish>
Property(S): LAUNCHCONFIGWIZARD = 1
MSI (s) (5C:DC) [14:41:02:119]: PROPERTY CHANGE: Adding CONFIGWIZARDURL property. Its value is 'http://www.google.com'.
MSI (c) (DC:60) [14:41:16:166]: PROPERTY CHANGE: Adding WixShellExecTarget property. Its value is 'C:\...Application\MyApplication.exe'.
Action ended 14:41:16: SetExec1. Return value 1.
MSI (c) (DC:60) [14:41:16:181]: Doing action: DoExec
Action 14:41:16: DoExec.
Action start 14:41:16: DoExec.
MSI (c) (DC:60) [14:41:16:181]: Creating MSIHANDLE (3) of type 790542 for thread 11104
MSI (c) (DC:E0) [14:41:16:181]: Invoking remote custom action. DLL: C:\Temp\MSIA7A.tmp, Entrypoint: WixShellExec
MSI (c) (DC!8C) [14:41:16:244]: Creating MSIHANDLE (4) of type 790541 for thread 10636
MSI (c) (DC!8C) [14:41:16:244]: Creating MSIHANDLE (5) of type 790531 for thread 10636
MSI (c) (DC!8C) [14:41:16:244]: Closing MSIHANDLE (5) of type 790531 for thread 10636
MSI (c) (DC!8C) [14:41:16:447]: Closing MSIHANDLE (4) of type 790541 for thread 10636
MSI (c) (DC:E0) [14:41:16:447]: Closing MSIHANDLE (3) of type 790542 for thread 11104
Action ended 14:41:16: DoExec. Return value 1.
MSI (c) (DC:60) [14:41:16:447]: Doing action: SetExec2
Action 14:41:16: SetExec2.
Action start 14:41:16: SetExec2.
MSI (c) (DC:60) [14:41:16:447]: PROPERTY CHANGE: Deleting WixShellExecTarget property. Its current value is 'C:\...Application\MyApplication.exe'.
Action ended 14:41:16: SetExec2. Return value 1.
Action ended 14:41:16: MyExitDialog. Return value 1.
Fairly straightforward, you'll need two separate actions to "set" WixShellExecTarget - they'll just run at different times.
First, you'll setup the actions that are going to be run.
<CustomAction Id="SetExec1" Property="WixShellExecTarget" Value="[#Application.exe]" />
<CustomAction Id="SetExec2" Property="WixShellExecTarget" Value="[CONFIGWIZARDURL]" />
<CustomAction Id="DoExec" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" Return="ignore" />
Now you want to schedule those actions to actually run, in this example I'm tying all of the actions to the Finish button on the final installation dialog. As we're publishing to a Control element, WiX will automatically set Publish/#Order to one greater than the previous event.
In addition, all these actions are conditioned to only execute during installation as this same dialog is displayed during removal and repair.
You'll likely also want to condition these based on the status of your checkboxes if execution is optional.
<UI>
<!-- Publish set/do for first action -->
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="SetExec1">
<![CDATA[NOT Installed]]>
</Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="DoExec">
<![CDATA[NOT Installed]]>
</Publish>
<!-- Publish set/do for second action -->
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="SetExec2">
<![CDATA[NOT Installed]]>
</Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="DoExec">
<![CDATA[NOT Installed]]>
</Publish>
</UI>