In effect, Windows Installer makes two passes over the actions in between
InstallInitialize and InstallFinalize. In the first pass, by the client
process that called MsiDoAction (which is msiexec.exe if you just ran an
.msi from Explorer), the installer writes out a script for the tasks each
standard action and *deferred* custom action must perform, but it doesn't
actually do them yet. Any *immediate* custom actions are, as the name
indicates, executed immediately when encountered.

The script generated is then handed off to the Windows Installer service
when the InstallFinalize action is encountered in the execute sequence. It's
this script which actually installs the files.

If you want to modify a file you're installing, you'll need a deferred
custom action. This has the limitation that it cannot read the original
database, only a special custom action data property which has the same name
as the custom action, plus a few other properties (only the script is passed
across to the Windows Installer service). The pattern that WiX uses is an
immediate custom action that appears in the execute sequence, which reads
tables to work out what to do, then schedules one or more deferred custom
actions to actually do the work (passing the commands in the custom action
data for the deferred actions).

If you do this, be sure to set the Modified and Created timestamps to the
same value, otherwise when you come to apply an upgrade, Windows Installer
will think that the user has modified the file and will not overwrite it.

-- 
Mike Dimmick

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Frédéric
Viollet
Sent: 23 July 2007 16:14
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] customactions and installsequence

Hi everyone.

I'm using CustomActions to modify some files after installation. But I 
don't really understand the order in which the actions are done.

In my source wxs, I have declared some <File> elements, a 
<ServiceInstall>, a <ServiceControl Id="Apache2_Service_Ctrl3" 
Name="APM_WEBSERVICE" Wait="yes" Start="install" /> and some custom 
actions. The sequence I would like to execute is:
-Install the files
-Install the service
-ConfigureHttpConf (custom action)
-start the service

To achieve this, I wrote the following code:

    <CustomAction Id='ConfigureHttpConf' BinaryKey='apmwsinst.dll' 
DllEntry='apm_edit_conf' />
    <InstallExecuteSequence>
      <Custom Action='ConfigureHttpConf'' After='InstallServices'>NOT 
Installed</Custom>
    </InstallExecuteSequence>
    <Binary Id='apmwsinst.dll' 
SourceFile="$(var.FACT_DESTDIR)\shared_lib\apmwsinst.dll" />
........
                <Directory Id="Apache2_bin_for_service_install" Name="bin">
                  <Component Id="APM_WEBSERVICES_APACHE_SERVICE" 
Guid="A0C7D596-6E76-493C-AA82-BD27596AB8B5">
                    <File Id="httpd_bin_Apache.exe" Name="Apache.exe" 
Source="$(var.FACT_DESTDIR)\ship\httpd\bin\Apache.exe" KeyPath="yes" />
                    <ServiceInstall Id="Apache2_Service" 
Name="APM_WEBSERVICE" Arguments="-k runservice" Type="ownProcess" 
Start="auto" ErrorControl="ignore" Description="IAM Policy Manager Web 
Service" DisplayName="IAM Policy Manager Administration WebService" 
Vital="no">
                      <ServiceDependency Id="Tcpip" />
                      <ServiceDependency Id="Afd" />
                    </ServiceInstall>
                    <ServiceControl Id="Apache2_Service_Ctrl1" 
Name="APM_WEBSERVICE" Wait="yes" Stop="both" />
                    <ServiceControl Id="Apache2_Service_Ctrl2" 
Name="APM_WEBSERVICE" Wait="yes" Remove="uninstall" />
                    <ServiceControl Id="Apache2_Service_Ctrl3" 
Name="APM_WEBSERVICE" Wait="yes" Start="install" />
                  </Component>
                </Directory>
...........

but I keep getting an error at install. The custom action fails because 
the file it is supposed to modify hasn't been installed yet. What am I 
doing wrong?

Thanks for your help.

Fred


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to