Are you also noticing an error from the custom action preventing your 
installation from succeeding?

The files are not actually installed until the script runs, so your custom 
actions will need to actually attempt to attach/detach as "deferred", not 
"immediate". Also, ALL actions that have side effects (such as 
attaching/removing databases) should ALWAYS be deferred, never immediate, in 
order to be able to participate in rollback, etc. in case of other installation 
errors. That preserves the transactional nature of Windows Installer.

The first time through the InstallExecuteSequence (up to InstallExecute, 
InstallExecuteAgain, or InstallFinalize) the script is recorded. At any of 
these three actions, the script is run (played back) before continuing on to 
the next action in the sequence. If an action is marked as immediate, it runs 
immediately (when it's position in the sequence is reached). If an action is 
marked as deferred, it is written into the script at that point (so it will 
still be run in order). That is what you need here.

If you need access to properties/tables/etc. you will need an 
immediate/deferred pair. The immediate should process the information in the 
database/environment and create data for the deferred action, then "schedule" 
the deferred action by calling DoAction on it.

-----Original Message-----
From: Pavel Oleinikov [mailto:node1...@gmail.com] 
Sent: Thursday, June 24, 2010 2:15 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Files are not copied if custom actions are defined

Hi people!

I have a strange trouble with WiX (I am a novice only...). There are
two components in my installer - Windows Service & Database. Also
there are two custom actions. If custom actions are defined, files are
not copied at all, target folder does not exist and custom action
"AttachDb", that wants to attach a database via a stored procedure
call, certainly fails, since database files are not exist (note -
section "InstallFiles" presents in the log). If custom actions are
commented out, all is OK, folder and files are created. Please help!
Many-many thanks in advance. Sorry for dummy and possibly annoying
question.

Source:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";
xmlns:ds="http://schemas.appsecinc.com/wix/DataSourceExtension";>
 <Product Name="..." Id="D40ACA06-B2FD-4037-A116-8261EBA3F1E6"
UpgradeCode="270C6F50-889D-491A-B880-AED91B4D78C7" Language="1049"
Codepage="1251" Version="1.0.0" Manufacturer="...">
   <Package Id="*" Keywords="installer" Description="..."
Comments="..." Manufacturer="..." InstallerVersion="200"
Languages="1049" Compressed="yes" SummaryCodepage="1251" />
   <Media Id="1" Cabinet="Tr.AppServer.cab" EmbedCab="yes" />
   <Directory Id="TARGETDIR" Name="SourceDir">
     <Directory Id="ProgramFilesFolder" Name="PFiles">
       <Directory Id="..." Name="...">
         <Directory Id="FINALFOLDER" Name="TR.AppServer">
           <Component Id="ServiceComponent"
Guid="88413F30-48FD-4485-A30B-649D39663A3A">
             <!-- common files, skipped for more readability -->
             <ServiceInstall Id="ServiceInstaller" Type="ownProcess"
Vital="yes" Name="SnoAppServer" DisplayName="..." Description="..."
Start="auto" Account="NT Authority\NetworkService"
ErrorControl="ignore" Interactive="no" />
             <ServiceControl Id="StartService" Start="install"
Stop="both" Remove="uninstall" Name="SnoAppServer" Wait="yes" />
           </Component>
           <Component Id="DatabaseComponent"
Guid="EAE6F275-EB88-4C13-8ABA-68F0335600C1">
             <File Id="TrDb.mdf" Name="TrDb.mdf" Source="DB\TrDb.mdf"
Vital="yes" KeyPath="no"/>
             <File Id="TrDb_log.ldf" Name="TrDb_log.ldf"
Source="DB\TrDb_log.ldf" Vital="yes" KeyPath="no"/>
           </Component>
         </Directory>
       </Directory>
     </Directory>
   </Directory>
   <CustomAction Id="AttachDb" BinaryKey="TrCustomActions"
DllEntry="AttachDb" Execute="immediate" Return="check" />
   <CustomAction Id="DetachDb" BinaryKey="TrCustomActions"
DllEntry="DetachDb" Execute="immediate" Return="check" />
   <InstallExecuteSequence>
     <Custom Action="AttachDb" After="InstallFiles">NOT Installed AND
&amp;DatabaseFeature=3</Custom>
     <Custom Action="DetachDb" Before="RemoveFiles">Installed AND
&amp;DatabaseFeature=3</Custom>
   </InstallExecuteSequence>
   <Feature Id="RootFeature" Title="..." Description="Полная
установка" Display="expand" Level="1"
ConfigurableDirectory="FINALFOLDER" AllowAdvertise="no">
     <Feature Id="ServiceFeature" Title="..." Description="..."
Level="1" AllowAdvertise="no">
       <ComponentRef Id="ServiceComponent" />
     </Feature>
     <Feature Id="DatabaseFeature" Title="..." Description="..."
Level="1" AllowAdvertise="no">
       <ComponentRef Id="DatabaseComponent" />
     </Feature>
   </Feature>
   <UIRef Id="WixUI_Mondo_Modified" />
   <PropertyRef Id="NETFRAMEWORK35" />
   <PropertyRef Id="NETFRAMEWORK35_SP_LEVEL" />
   <Property Id="WIXUI_INSTALLDIR" Value="FINALFOLDER" />
   <Property Id="CREATE_DATABASE_LOGON_TYPE" Value="WinAuthCurrentUser" />
   <Condition Message="...">Privileged</Condition>
   <Condition Message="..."><![CDATA[Installed OR (((VersionNT = 501)
AND (ServicePackLevel >= 3)) OR (VersionNT > 501))]]></Condition>
   <Condition Message="..."><![CDATA[Installed OR
(NETFRAMEWORK35_SP_LEVEL AND (NETFRAMEWORK35_SP_LEVEL >=
"#1"))]]></Condition>
   <Binary Id="TrCustomActions"
SourceFile="..\TR.Setup.CustomActions\bin\Debug\TR.Setup.CustomActions.CA.dll"
/>
 </Product>
</Wix>


Terveisin, Pavel
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to