I want to:
- Create a directory.
- Run another installer (not MSI) that installs some files into directory from point 1.
- Replace some of the files installed at point 2.
All of these must be done under my installation created with the help of WiX (Windows Installer XML).
There is an important part of my WiX file below. The problem is this installation doesn't replace the files as I want. To remove files I use RemoveFile element with Property attribute, because it is the only way (except writing code within custom action - that is I do not want) to remove files that isn't in the installer database.
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="ManufacturerDirectory" Name="$(var.Manufacturer)">
<Directory Id="ProductDirectory" Name="$(var.ProductName)">
<Directory Id="SubDirectory" Name="$(var.SubDirectoryName)">
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
<!-- Create the directory at point 1. -->
<Component
Id="RemoveOldData" Guid="..." KeyPath="yes"
Directory="ManufacturerDirectory">
<CreateFolder Directory="ProductDirectory" />
</Component>
<!-- Following two components replace the file(s) (point 3). -->
<Component
Id="RemoveOldData" Guid="..."
Directory="SubDirectory" KeyPath="yes"
>
<RemoveFile
Id="Remove_MyFile.exe" On="install"
Property="SUBDIRECTORYPROPERTY" Name="MyFile.exe" />
</Component>
<Component
Id="FilesToReplace" Guid="..."
Directory="SubDirectory">
<File
Id="MyFile.exe" Vital="yes" KeyPath="yes" DiskId="1"
Source="$(var.SourcePath)MyFile.exe" Name="MyFile.exe"
/>
</Component>
<Binary Id="WiseInstallation" SourceFile="$(var.WiseSourcePath)..." />
<!-- Launch Wise installation at point 2. -->
<CustomAction
Id="LaunchWiseInstallation"
BinaryKey="WiseInstallation"
ExeCommand=""
Return="check"
Execute="deferred"
Impersonate="yes" />
<!-- Following custom action assigns a property.
This needs to remove files that are not in the current installer database.
To do it, the Property attribute of the RemoveFile element is needed. -->
<CustomAction
Id="Assign_SUBDIRECTORYPROPERTY"
Property="SUBDIRECTORYPROPERTY"
Value="[SubDirectory]" />
<InstallExecuteSequence>
<Custom Action="Assign_SUBDIRECTORYPROPERTY" After="InstallInitialize" >
NOT Installed</Custom>
<Custom Action="LaunchWiseInstallation" After="CreateFolders" >
NOT Installed</Custom>
<RemoveFiles Sequence="3720"/>
<RemoveFolders Sequence="3730"/>
</InstallExecuteSequence>
InstallExecuteSequence from Orca's view:
- ValidateProductID 700
- CostInitialize 800
- FileCost 900
- CostFinalize 1000
- InstallValidate 1400
- InstallInitialize 1500
- Assign_SUBDIRECTORYPROPERTY 1501
- ProcessComponents 1600
- UnpublishFeatures 1800
- RemoveRegistryValues 2600
- RemoveShortcuts 3200
- CreateFolders 3700
- LaunchWiseInstallation 3701
- RemoveFiles 3720
- RemoveFolders 3730
- InstallFiles 4000
- CreateShortcuts 4500
- WriteRegistryValues 5000
- RegisterUser 6000
- RegisterProduct 6100
- PublishFeatures 6300
- PublishProduct 6400
- InstallFinalize 6600
I also checked install log file:
- the SUBDIRECTORYPROPERTY property was assigned well;
- the InstallExecuteSequence was followed properly;
- installation was completed without errors.
BUT THE FILES WASN'T EVER REMOVED OR REPLACED!