How do I make a 64 bit MSI? - wix

I've specified:
-arch x64 when running candle.exe.
Platform=x64 on the Package.
ProgramFiles64Folder as the Directory id where things get installed.
and still, when the app gets installed, it goes to C:\Program Files (x86).
There are some other wxs generated by heat.exe. I tried adding -platform x64 and -platform win64 to the calls to heat.exe, but it made no difference.
I read
https://msdn.microsoft.com/en-us/library/gg513929.aspx
The section on 64 bit installer in the Wix Cookbook
How do I get WiX to generate a 64-bit MSI?
and I think I'm doing everything that was described there.
What am I missing?
I've came up with a minimum case that looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Project X" Manufacturer="X LLC" Language="1033" Version="1.0.0.0"
UpgradeCode="5bf2131c-4068-4cb3-adac-bc9c79ed8ce3">
<Package InstallerVersion="301" Compressed="yes" InstallScope="perMachine" Platform="x64"/>
<Property Id="ApplicationFolderName" Value="Project X"/>
<Property Id="WixAppFolder" Value="WixPerMachineFolder"/>
<UI>
<UIRef Id="WixUI_Advanced"/>
</UI>
</Product>
</Wix>
and I compile it like this:
candle.exe -arch x64 -ext WixUIExtension -ext WixUtilExtension ProjectX.wxs
light.exe -ext WixUIExtension -ext WixUtilExtension -out ProjectX-1.0.0-beta.3-win64.msi ProjectX.wixobj
It obviously complaints about the media table being empty:
> candle.exe -arch x64 -ext WixUIExtension -ext WixUtilExtension ProjectX.wxs
Windows Installer XML Toolset Compiler version 3.11.0.1701
Copyright (c) .NET Foundation and contributors. All rights reserved.
ProjectX.wxs
> light.exe -ext WixUIExtension -ext WixUtilExtension -out ProjectX-1.0.0-beta.3-win64.msi ProjectX.wixobj
Windows Installer XML Toolset Linker version 3.11.0.1701
Copyright (c) .NET Foundation and contributors. All rights reserved.
C:\Users\pupeno\AppData\Local\Temp\h1k0echv\ProjectX-1.0.0-beta.3-win64.msi : warning LGHT1076 : ICE71: The Media table has no entries.
But the installer is still generated and it still points to C:\Program Files (x86):
The full .wxs looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" Name="ProjectX" Manufacturer="X Inc" Language="1033"
Version="$(var.MSIProductVersion)" UpgradeCode="">
<Package InstallerVersion="301" Compressed="yes" InstallScope="perMachine" Platform="x64"/>
<MediaTemplate EmbedCab="yes"/>
<Icon Id="Icon_ProjectX.ico" SourceFile="src\main\installer\ProjectX.ico"/>
<WixVariable Id="WixUISupportPerUser" Value="0"/>
<Property Id="ApplicationFolderName" Value="X Inc\ProjectX"/>
<Property Id="WixAppFolder" Value="WixPerMachineFolder"/>
<Property Id="ARPPRODUCTICON" Value="Icon_ProjectX.ico"/>
<WixVariable Id="WixUILicenseRtf" Value="src\main\installer\eula.rtf"/>
<WixVariable Id="WixUIBannerBmp" Value="src\main\installer\WixUIBannerBmp.bmp"/>
<WixVariable Id="WixUIDialogBmp" Value="src\main\installer\WixUIDialogBmp.bmp"/>
<Property Id="AUTO_CONNECT_TO">
<RegistrySearch Id="AutoConnectTo" Root="HKLM" Key="Software\X Inc\ProjectX" Name="AutoConnectTo"
Type="raw"/>
</Property>
<Property Id="RUN_ProjectX_ON_EXIT" Value="true"/>
<Property Id="INSTALL_SCREENSAVER_ON_EXIT" Value="true"/>
<Property Id="STAGING_DIR" Value="undefined"/>
<Property Id="ARCH" Value="undefined"/>
<UI>
<UIRef Id="DM_WixUI_Advanced"/>
<Publish Dialog="DM_ExitDialog" Control="Finish" Event="DoAction" Value="CA_Run_ProjectX">
RUN_ProjectX_ON_EXIT and <![CDATA[&Ftr_Configurator=3]]> and NOT Installed
</Publish>
<Publish Dialog="DM_ExitDialog" Control="Finish" Event="DoAction" Value="CA_Install_Screensaver">
INSTALL_SCREENSAVER_ON_EXIT and <![CDATA[&Ftr_Screensaver=3]]> and NOT Installed
</Publish>
<Dialog Id="DM_ExitDialog" Width="370" Height="270" Title="!(loc.ExitDialog_Title)">
<Control Id="Finish" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Cancel="yes"
Text="!(loc.WixUIFinish)"/>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Disabled="yes"
Text="!(loc.WixUICancel)"/>
<Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no"
Text="!(loc.ExitDialogBitmap)"/>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes"
Text="!(loc.WixUIBack)"/>
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0"/>
<Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="40" Transparent="yes"
NoPrefix="yes"
Text="Thank you for choosing ProjectX. We sincerely hope it satisfies your needs."/>
<Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes"
Text="!(loc.ExitDialogTitle)"/>
<Control Id="RunProjectXCheckBox" Type="CheckBox" X="135" Y="150" Width="220" Height="40" Hidden="yes"
Property="RUN_ProjectX_ON_EXIT" CheckBoxValue="1" Text="Run ProjectX Configurator">
<Condition Action="show"><![CDATA[&Ftr_Configurator=3]]></Condition>
</Control>
<Control Id="InstallScreensaverCheckBox" Type="CheckBox" X="135" Y="190" Width="220" Height="40"
Hidden="yes" Property="INSTALL_SCREENSAVER_ON_EXIT" CheckBoxValue="1"
Text="Install ProjectX as your screensaver">
<Condition Action="show"><![CDATA[&Ftr_Screensaver=3]]></Condition>
</Control>
</Dialog>
<InstallUISequence>
<Show Dialog="DM_ExitDialog" OnExit="success" Overridable="yes"/>
</InstallUISequence>
<AdminUISequence>
<Show Dialog="DM_ExitDialog" OnExit="success" Overridable="yes"/>
</AdminUISequence>
</UI>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed."/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="APPLICATIONFOLDER">
<Directory Id="Dir_jre" Name="jre"/>
<Directory Id="Dir_jars" Name="jars"/>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="Dir_Menu_ProjectX" Name="ProjectX"/>
</Directory>
<Component Id="Cmp_Auto_Connect_to" Win64="yes">
<RegistryValue Root="HKLM" Key="Software\X Inc\ProjectX" Name="AutoConnectTo" Type="string"
Value="[AUTO_CONNECT_TO]"/>
</Component>
<Directory Id="SystemFolder"/>
</Directory>
<DirectoryRef Id="APPLICATIONFOLDER">
<Component Id="Cmp_ProjectX_Configurator_exe" Guid="" Win64="yes">
<File Id="File_FT_D_ProjectX_Configurator_exe"
Source="$(var.STAGING_DIR)\ProjectX Configurator.exe" KeyPath="yes">
<Shortcut Id="Shrt_ProjectX_Configurator" Name="ProjectX Configurator" Directory="Dir_Menu_ProjectX"
Advertise="yes" Icon="Icon_ProjectX.ico"/>
</File>
<RemoveFolder Id="Rm_Menu_ProjectX_1" Directory="Dir_Menu_ProjectX" On="uninstall"/>
</Component>
<Component Id="Cmp_ProjectX_Displayer_exe" Guid="" Win64="yes">
<File Id="File_FT_D_ProjectX_Displayer_exe" Source="$(var.STAGING_DIR)\ProjectX Displayer.exe"
KeyPath="yes">
<Shortcut Id="Shrt_ProjectX_Displayer" Name="ProjectX Displayer" Directory="Dir_Menu_ProjectX"
Advertise="yes" Icon="Icon_ProjectX.ico"/>
</File>
<RemoveFolder Id="Rm_Menu_ProjectX_2" Directory="Dir_Menu_ProjectX" On="uninstall"/>
</Component>
<Component Id="Cmp_ProjectX_Renderer_exe" Guid="" Win64="yes">
<File Id="File_FT_D_ProjectX_Renderer_exe" Source="$(var.STAGING_DIR)\ProjectX Renderer.exe"
KeyPath="yes">
<Shortcut Id="Shrt_ProjectX_Renderer" Name="ProjectX Renderer" Directory="Dir_Menu_ProjectX"
Advertise="yes" Icon="Icon_ProjectX.ico"/>
</File>
<RemoveFolder Id="Rm_Menu_ProjectX_3" Directory="Dir_Menu_ProjectX" On="uninstall"/>
</Component>
<Component Id="Cmp_Prosaver_scr" Guid="" Win64="yes">
<File Id="File_FT_D_Prosaver_scr" Source="$(var.STAGING_DIR)\Prosaver.scr" KeyPath="yes"/>
</Component>
<Component Id="Cmp_Icon" Guid="" Win64="yes">
<File Id="File_Icon" Source="src\main\installer\ProjectX.ico" KeyPath="yes"/>
</Component>
</DirectoryRef>
<DirectoryRef Id="Dir_Menu_ProjectX">
<Component Id="Cmp_Install_Screensaver" Guid="" Win64="yes">
<Shortcut Id="Shrt_Install_Screensaver" Name="Install ProjectX Screensaver"
WorkingDirectory="SystemFolder" Icon="Icon_ProjectX.ico"
Target="[SystemFolder]rundll32.exe"
Arguments="desk.cpl,InstallScreenSaver [#File_FT_D_Prosaver_scr]"/>
<RemoveFolder Id="Rm_Menu_ProjectX_4" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\X Inc\ProjectX" Name="installed" Type="integer"
Value="1" KeyPath="yes"/>
</Component>
<Component Id="Cmp_ProjectX_Support" Guid="" Win64="yes">
<util:InternetShortcut Id="IShrt_ProjectX_Support" Name="ProjectX Support" IconFile="[#File_Icon]"
Target="https://support.ProjectX.tech"/>
<RemoveFolder Id="Rm_Menu_ProjectX_5" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\X Inc\ProjectX" Name="installed" Type="integer"
Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<CustomAction Id="CA_Run_ProjectX" Directory="APPLICATIONFOLDER" Return="asyncNoWait"
ExeCommand="[#File_FT_D_ProjectX_Configurator_exe]"/>
<CustomAction Id="CA_Install_Screensaver" Directory="SystemFolder" Return="asyncNoWait"
ExeCommand="[SystemFolder]rundll32.exe desk.cpl,InstallScreenSaver [#File_FT_D_Prosaver_scr]"/>
<Feature Id="ProductFeature" Title="ProjectX" Level="1" Display="expand"
Description="ProjectX.">
<ComponentGroupRef Id="ComGrp_JRE"/>
<ComponentGroupRef Id="ComGrp_JARS"/>
<ComponentRef Id="Cmp_Auto_Connect_to"/>
<ComponentRef Id="Cmp_ProjectX_Support"/>
<ComponentRef Id="Cmp_Icon"/>
<Feature Id="Ftr_Configurator" Title="Configurator" Level="1"
Description="This is the application you use to register a new account as well as configure what websites are displayed, what displayers and renderers have access, etc. You need this in at least one computer to control your account.">
<ComponentRef Id="Cmp_ProjectX_Configurator_exe"/>
</Feature>
<Feature Id="Ftr_Displayer" Title="Displayer" Level="1"
Description="This is what displays web sites. You need this (or the screensaver) on all the computers connected to screens that displays web sites.">
<ComponentRef Id="Cmp_ProjectX_Displayer_exe"/>
</Feature>
<Feature Id="Ftr_Renderer" Title="Renderer" Level="1"
Description="This accesses your websites and generates the screenshots for the displayers. You need at least one of these although the Configurator can also act as a Renderer.">
<ComponentRef Id="Cmp_ProjectX_Renderer_exe"/>
</Feature>
<Feature Id="Ftr_Screensaver" Title="Screensaver" Level="1"
Description="This is what displays web sites as the screensaver. You need this (or the displayer) on all the computers connected to screens that displays web sites.">
<ComponentRef Id="Cmp_Prosaver_scr"/>
<ComponentRef Id="Cmp_Install_Screensaver"/>
</Feature>
</Feature>
</Product>
</Wix>
The summary information for the generated MSI looks like this (GUID changed):
and the directory points to the use of ProgramFiles64Folder. I can't find anything wrong:
%ProgramFiles% still points to the correct place:
>echo %ProgramFiles%
C:\Program Files
and I also had this fail on two separate computers in the same way (installing to C:\Program Files (x86)).
If I change the Directory to be ProgramFilesFolder instead of ProgramFiles64Folder, then, I get the expected errors:
error LGHT0204 : ICE80: This 64BitComponent cmpCBBF8379128F087B61BD92F8113C95D6 uses 32BitDirectory dir451F8F132CB17CBF5649679474428CE4
Just in case, I open the registry editor and removed all mentions of C:\Program Files (x86)\X LCC. That made no difference :(
I tried specifying a name to the directory, as an experiment:
<Directory Id="ProgramFiles64Folder" Name="Program Files">
and that made no difference either.

Very rushed: In your compiled MSI, maybe try to change the below entry in the Custom Action table first (use Orca to hotfix after compilation):
change:
WixSetDefaultPerMachineFolder, 51, WixPerMachineFolder, [ProgramFilesFolder], [ApplicationFolderName]
into:
WixSetDefaultPerMachineFolder, 51, WixPerMachineFolder, [ProgramFiles64Folder], ApplicationFolderName]
I don't have time to test the above properly, but if you look in the CustomAction table you will see that WixSetDefaultPerMachineFolder assigns [ProgramFilesFolder][ApplicationFolderName] to WixPerMachineFolder. Then you have lots of stuff going on in the ControlEvent table with WixAppFolder = "WixPerMachineFolder" etc... Quite confusing. Then it looks like WixPerMachineFolder is assigned to APPLICATIONFOLDER. The actual property used in the dialog seems to be WIXUI_INSTALLDIR. Can't track it all right now - please try the simple hack above (just set the path to ProgramFiles64Folder) - it might yank the paths into submission. Then test the whole thing to death in all installation mode (install, repair, self-repair, modify, uninstall, major upgrade, patch, admin install, etc...).
Sorry for the rush, good luck.

What does your directory table look like? Are you using ProgramFilesFolder or ProgramFilesFolder64?
You'll also need to mark your components as 64 bit. Since the media table is complaining I'm guessing you don't have any component data yet.

Related

WiX service don't start: service failed to start verify that you have sufficient privileges

I have a java application. I have made an scansol-agent-app.exe file from that i need to make an installer with WiX. Below there is a code of scansol-agent.wxs file. I need to install this app as windows service. Servise installs well, but don't starts. Windows shows me an error: “Service failed to start - Verify that you have sufficient privileges to start system services”
I tried all variants that could find, but no any results. How can i start this service?
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
UpgradeCode="{EB6B8302-C06E-4bec-ADAC-932C68A3A98D}"
Name="Scansol Agent Application Service"
Version="0.0.1"
Manufacturer="ScienceSoft"
Language="1033">
<Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package" Manufacturer="ScienceSoft"/>
<Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>
<Property Id="WHSLogo">1</Property>
<WixVariable Id="WixUILicenseRtf" Value="license.rtf" />
<UI>
<Property Id="ApplicationFolderName" Value="WiX Demo" />
<Property Id="WixAppFolder" Value="WiXxperMachineFolder" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
<!-- Skip license dialog -->
<Publish Dialog="WelcomeDlg"
Control="Next"
Event="NewDialog"
Value="InstallDirDlg"
Order="2">1</Publish>
<Publish Dialog="InstallDirDlg"
Control="Back"
Event="NewDialog"
Value="WelcomeDlg"
Order="2">1</Publish>
<!--<Property Id="DefaultUIFont">DlgFont8</Property>-->
<TextStyle Id="DlgFont8" FaceName="Tahoma" Size="8" />
<TextStyle Id="DlgTitleFont" FaceName="Tahoma" Size="8" Bold="yes" />
<Dialog Id="InstallDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
<Text>{\DlgTitleFont}Ready to Install</Text>
</Control>
<Control Id="Install" Type="PushButton" X="304" Y="243" Width="56" Height="17"
Default="yes" Text="Install">
<Publish Event="EndDialog" Value="Return" />
</Control>
</Dialog>
</UI>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="INSTALLDIR" Name="ScansolAgent">
<Component Id="ApplicationServiceInstall" Guid="{908B7199-DE2A-4dc6-A8D0-27A5AE444FEA}">
<File Id='ApplicationFile1' Source="scansol-agent-app.exe" DiskId='1' KeyPath='yes' Vital='yes'/>
<File Id="ApplicationFile2" Source="config.cfg" DiskId='1' KeyPath='no' Vital='yes'/>
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="ScansolAgentService"
DisplayName="Scansol Agent Application Service"
Description="File Monitoring and Loading to server"
Start="auto"
Account="LocalSystem"
ErrorControl="ignore"
Interactive="no"
>
</ServiceInstall>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="ScansolAgentService" Wait="yes" />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="DefaultFeature" Level="1" Title="ScansolAgentAppService">
<ComponentRef Id="ApplicationServiceInstall" />
</Feature>
</Product>
</Wix>
The reasons could be many and vast majority of those were addressed, however, I had a case that none of the answers or suggestions were applicable to it. At the end I found the reason for my case: in the ServiceInstall tag there is an attribute named Account, which in my case was LocalService, however, in my project for the Windows Service, in the generated file I assigned for my service the account to be LocalSystem. So if the service account set in the windows service project does not match to what you later specify in your WiX source file under the ServiceInstall's Account attribute, then the Windows Installer will successfully install your service, however, will fail on starting it. Conclusion, make sure the service accounts match at both places. And again, this might not be your case, but is worth to double check.
Please see this answer: https://stackoverflow.com/a/65342252/6657445. For this case, because this is not a domain or local user account, try flipping "Interactive" to "yes". I have other services installed this way without issue.

Wix remove appdata folder on uninstall

I am using Wix 3.11 and have tried a number of different ways and methods and can't seem to be able to figure out why Wix isn't removing my ApplicationDataFolder folder. During install I create the folder in the ApplicationDataFolder location for the user.
My application uses logging and stores it along with a few other things in the directory. During uninstall everything in the application folder is removed but the appdata folder with the logs and other files are left untouched.
I can't figure out why or what I am missing.
WXS Template
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" UpgradeCode="9e578e3d-0119-425c-8633-f54ffaaa4929" Name="#product.name#" Version="#product.version#" Manufacturer="#product.company#" Language="1033">
<Package InstallerVersion="400" Compressed="yes" InstallScope="perMachine" Comments="#product.version#" Description="#product.description#"/>
<Media Id="1" Cabinet="SomeApp.cab" EmbedCab="yes" />
<!-- Installer Properties -->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<PropertyRef Id="WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED"/>
<!-- Installer Resources -->
<Icon Id="ApplicationIcon" SourceFile="SomeApp 4\SomeApp 4_vista.ico"/>
<Property Id="ARPPRODUCTICON" Value="ApplicationIcon" />
<Property Id="INSTALLDIR">
<RegistrySearch Key="SOFTWARE\Acme\SomeApp"
Root="HKCU" Type="raw"
Id="APPLICATIONFOLDER_REGSEARCH" Name="installation-path" />
</Property>
<WixVariable Id="WixUILicenseRtf" Value="SomeApp 4\license.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="WixUIBannerBmp.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="WixUIDialogBmp.bmp" />
<!-- Check Existing Install -->
<Upgrade Id="9e578e3d-0119-425c-8633-f54ffaaa4929">
<UpgradeVersion Minimum="#product.version#" OnlyDetect="yes" Property="NEWERVERSIONDETECTED"/>
<UpgradeVersion Minimum="0.0.0" Maximum="#product.version#" IncludeMinimum="yes" IncludeMaximum="no" Property="OLDERVERSIONBEINGUPGRADED"/>
</Upgrade>
<Condition Message="A newer version of this software is already installed.">NOT NEWERVERSIONDETECTED</Condition>
<!-- Prerequisites -->
<Condition Message="This application requires .NET Framework 4.6 or newer. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED]]>
</Condition>
<Condition Message="This application requires at least Windows 7 or Windows Server 2008 R2. Please upgrade your computer to a supported operating system and run this installer again.">
<![CDATA[Installed OR (VersionNT >= 601)]]>
</Condition>
<!-- Define the directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="ProgramFiles">
<Directory Id="INSTALLDIR" Name="#product.company#">
#product.applicationfiles#
#product.servicefiles#
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="#product.name#"/>
<Directory Id="ServiceProgramsFolder" Name="#product.name#"/>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
<Directory Id="LocalAppDataFolder">
<Directory Id="ApplicationDataFolder" Name="Acme" />
</Directory>
</Directory>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="1e578e4d-0229-425c-8633-f54ffaaa4901">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="SomeApp 4.6"
Description="#product.company# #product.name# #product.version#"
Target="[INSTALLDIR]SomeApp 4\SomeApp.UserInterface.exe"
WorkingDirectory="INSTALLDIR"
Icon ="ApplicationIcon"/>
<Shortcut Id="ApplicationStartMenuShortcut2"
Name="SomeApp 4.6 (Multiple Instances)"
Description="#product.company# #product.name# #product.version#"
Target="[INSTALLDIR]SomeApp 4\SomeApp.UserInterface.exe"
Arguments="MultipleInstance=True"
WorkingDirectory="INSTALLDIR"
Icon ="ApplicationIcon"/>
<Shortcut Id="ApplicationStartMenuShortcut3"
Name="SomeApp 4.6 (Notifications)"
Description="#product.company# #product.name# #product.version#"
Target="[INSTALLDIR]SomeApp 4\SomeApp.UserInterface.exe"
Arguments="Notifications=True"
WorkingDirectory="INSTALLDIR"
Icon ="ApplicationIcon"/>
<Shortcut Id="HelpStartMenuShortcut"
Name="SomeApp 4.6 Help"
Target="[INSTALLDIR]SomeApp 4\Documentation\SomeApp.chm"
WorkingDirectory="INSTALLDIR"/>
<Shortcut Id="UninstallProduct"
Name="Uninstall SomeApp 4.6"
Target="[SystemFolder]msiexec.exe"
Arguments="/x [ProductCode]"
Description="Uninstall #product" />
<Shortcut Id="desktopshortcut"
Directory="DesktopFolder"
Name="SomeApp 4.6"
WorkingDirectory="INSTALLDIR"
Target="[INSTALLDIR]SomeApp 4\SomeApp.UserInterface.exe" />
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<util:RemoveFolderEx On="uninstall" Property="ApplicationDataFolder" />
</Component>
</DirectoryRef>
<DirectoryRef Id="ServiceProgramsFolder">
<Component Id="ServiceShortcut" Guid="9e578e3d-0229-425c-8633-f54ffaaa4901">
<Shortcut Id="ServiceStartMenuShortcut"
Name="#product.name# Reporting Service"
Description="#product.name# Reporting Service"
Target="[INSTALLDIR]Reporting\SomeApp.ReportingService.exe"
WorkingDirectory="INSTALLDIR"
Icon ="ApplicationIcon"/>
<RemoveFolder Id="ServiceProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\Acme\SomeApp" Name="service-installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<DirectoryRef Id="INSTALLDIR">
<Component Id="CleanupMainApplicationFolder" Guid="*">
<RegistryValue Root="HKCU" Key="SOFTWARE\Acme\SomeApp" Name="installation-path" Type="string" Value="[INSTALLDIR]" KeyPath="yes" />
<util:RemoveFolderEx On="uninstall" Property="INSTALLDIR" />
<util:RemoveFolderEx On="uninstall" Property="ApplicationDataFolder" />
</Component>
</DirectoryRef>
<!-- Feature: SomeApp Application -->
<Feature Id="Feature.Application"
Title="SomeApp 4 - Application"
Description="SomeApp is an asset management and maintenance application designed to optimize asset value and improve manufacturing productivity."
ConfigurableDirectory="INSTALLDIR"
Level="1"
AllowAdvertise="no">
#product.applicationcomponents#
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="CleanupMainApplicationFolder" />
</Feature>
<!-- Feature: Reporting Service -->
<Feature Id="Feature.Service"
Title="SomeApp 4 - Reporting Service"
Description="This service generates and delivers reports that have been scheduled in the SomeApp Maintenance Management System."
ConfigurableDirectory="INSTALLDIR"
Level="3"
AllowAdvertise="no">
#product.servicecomponents#
<ComponentRef Id="ServiceShortcut" />
<Component Id="ReportingServiceInstaller" Guid="B72CAA3F-F2DB-48D2-90DD-061209AB2CE5" Directory="INSTALLDIR">
<CreateFolder />
<File Id="ReportingService.exe" Name="ReportingService.exe" KeyPath="yes" Source="#product.sourcedir#\Reporting\SomeApp.ReportingService.exe"/>
<ServiceInstall Id="ReportingServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="SomeApp Reporting Service"
DisplayName="SomeApp - Reporting Service"
Description="This service generates and delivers reports that have been scheduled in the SomeApp Maintenance Management System."
Start="auto"
Account="NT AUTHORITY\LocalService"
ErrorControl="ignore"
Interactive="no" />
</Component>
</Feature>
<CustomAction Id="Cleanup_logfile" Directory="INSTALLDIR"
ExeCommand="cmd /C "rmdir %LOCALAPPDATA%\Acme /s /q""
Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="Cleanup_logfile" After="RemoveFiles" >
REMOVE="ALL"
</Custom>
</InstallExecuteSequence>
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallValidate"/>
</InstallExecuteSequence>
<UIRef Id="WixUI_FeatureTree" />
<UI>
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<!-- Add the GUI logic for installation -->
</UI>
</Product>
</Wix>
I have one project that uses util:RemoveFolderEx where it is working properly. The only difference I can see is that I explicitly set a property at runtime to the value of the install directory. My guess is that "INSTALLDIR" and "ApplicationDataFolder" are not actually properties since they are stored in the Directory table of your msi and not the property table. (Checked using ORCA)
Try doing
<SetProperty Id='AcmeAppDataFolderToRemove' Value='[ApplicationDataFolder]' After='AppSearch'/>
and then change your util:RemoveFolderEx to
<util:RemoveFolderEx On="uninstall" Property="AcmeAppDataFolderToRemove" />
and see if that works. (You might need to use Value='ApplicationDataFolder' without the []'s not sure.)
In response to your edit I went and looked at the RemoveFolderEx page and this looks important
The custom action that implements RemoveFolderEx does so by writing temporary rows to the RemoveFile table for each subfolder of the root folder you specify. Because it might dramatically affect Windows Installer's File Costing, the temporary rows must be written before the CostInitialize standard action. Unfortunately, MSI doesn't create properties for the Directory hierarchy in your package until later, in the CostFinalize action.
I figured setting it to the directory would work but apparently these directories don't have values yet when RemoveFolderEx action actually executes. So, when this tries to resolve the properties or set the properties they are actually just empty.
A difference in what I said my installer does and what it actually does is that I get the value I set the property to through a RegistrySearch.
<Property Id="INSTALLDIR">
<RegistrySearch
Id='InstallDirRegistrySearch'
Type='raw'
Root='HKLM'
Key='SOFTWARE\$(var.OEMRegistryRootKeyName)'
Name='SDKPath' />
</Property>
<SetProperty Id='SDKFolderToRemove' Value='[INSTALLDIR]\$(var.OEMProduct) SDK' After='AppSearch'/>
So I would try writing the appdata dir to a registry key and getting the value into a property via registry search then using that property in your removefolderex, you probably don't need the setproperty, I just used it because I needed a folder under INSTALLDIR but in your case you can just have the registry key be the right folder.

Wix uninstall not removing files, always assumes program files\myApp folder

I'm having a problem with the Wix installer and don't know what specifically I'm missing.
I have enabled the dialog to allow user pick their own installation folder over the default of
If I run the install and just leave the default of "Program Files\MyApp", the app installs no problem. If I then uninstall, all the files and folders properly get deleted.
If I run the install and change the default to something like c:\TestFolder\MyApp, it installs no problem to that location and includes the subfolder for the Java64bit and Java64bit/lib folders with respective content.
Then, if I immediately do an uninstall, it properly removes the Java stuff completely, but leaves all the files within the c:\TestFolder\MyApp root.
Looking into the registry after install, it DOES show the proper install directory location. What else can I provide to help resolve this.
Here is the full (with GUIDs removed) install of different files
File for the main (sample) product
<?xml version="1.0" encoding="utf-32BE"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product
Name="AMyApp"
Manufacturer="Testing"
Language="1033"
Version="1.0.1.0"
Id="*"
UpgradeCode="{GUID1}" >
<?include AMyApp_Define_Paths.wxi ?>
<Package
Id="*"
InstallerVersion="200"
Platform="x64"
Compressed="yes"
Languages="1033"
SummaryCodepage="1252"
Comments="AMyApp Package Comments area"
Description ="AMyApp"
InstallScope="perMachine" />
<MajorUpgrade
AllowDowngrades="no"
AllowSameVersionUpgrades="yes"
DowngradeErrorMessage="A newer version of AMyApp is already installed." />
<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="{GUID1}">
<UpgradeVersion
Minimum="4.0.0.0" Maximum="99.0.0.0"
Property="PREVIOUSVERSIONSINSTALLED"
IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>
<Media Id="1"
Cabinet="AMyApp.cab"
EmbedCab="yes" />
<WixVariable Id="ALLUSERS" Value="2" />
<WixVariable Id="MSIINSTALLPERUSER" Value="" />
<!-- see if location from a previously installed instance. -->
<Property Id="INSTALLDIR" >
<RegistrySearch Id="AMYAPP" Type="raw"
Root="HKLM" Key="SOFTWARE\AMYAPP" Name="InstallDir" />
</Property>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<!-- Search registry for previous installed location -->
<Property Id="PREVIOUSINSTALLFOLDER">
<RegistrySearch Id="GetPreviousInstallFolder" Root="HKLM"
Key="SOFTWARE\AMYAPP" Name="INSTALLDIR" Type="raw" />
</Property>
<CustomAction Id="SetINSTALLDIR" Property="INSTALLDIR"
Value="[PREVIOUSINSTALLFOLDER]" Execute="firstSequence" />
<CustomAction Id="SetWIXUI_INSTALLDIR" Property="WIXUI_INSTALLDIR"
Value="[PREVIOUSINSTALLFOLDER]" Execute="firstSequence" />
<InstallExecuteSequence>
<Custom Action="SetINSTALLDIR"
After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
<Custom Action="SetWIXUI_INSTALLDIR"
After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
</InstallExecuteSequence>
<InstallUISequence>
<Custom Action="SetINSTALLDIR"
After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
<Custom Action="SetWIXUI_INSTALLDIR"
After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
</InstallUISequence>
<Directory Id="TARGETDIR" Name="SourceDir" >
<!-- The directories "DesktopFolder", "FontsFolder", "ProgramFilesFolder"
are all pre-defined common names via the installer and reference the
actual windows locations respectively -->
<Directory Id="DesktopFolder" />
<Directory Id="FontsFolder" />
<Directory Id="ProgramFiles64Folder" >
<!-- The "ID" is the name internally that refers to the folder when
trying to install files, etc... the "Name" is what the actual name
will be at actual install time as viewed by Windows Explorer -->
<Directory Id="INSTALLDIR" Name="AMYAPP" >
<Component Id="C_HKLM_AMyAppUsage" Guid="{GUID2}">
<RegistryKey Root="HKLM" Key="SOFTWARE\AMyApp" >
<RegistryValue Name="IsSomeKey" Type="string" Value="YES" KeyPath="yes" />
</RegistryKey>
</Component>
<Directory Id="Java64BitDIR" Name="Java64Bit" >
<Directory Id="Java64BitLibDIR" Name="Lib" />
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id="AMyApp_Features"
Title="AMyApp (Wix Testing)"
Level="1"
ConfigurableDirectory="INSTALLDIR" >
<ComponentRef Id="C_HKLM_AMyAppUsage" />
<ComponentRef Id="AMyApp_CORE" />
<ComponentRef Id="AMyApp_Shortcuts" />
<ComponentRef Id="JAVA64BIT_Support" />
<ComponentRef Id="JAVA64BITLIB_Support" />
</Feature>
<UI>
<UIRef Id="WixUI_InstallDir" />
<!-- Skip license dialog -->
<Publish Dialog="WelcomeDlg"
Control="Next"
Event="NewDialog"
Value="InstallDirDlg"
Order="2">1</Publish>
<Publish Dialog="InstallDirDlg"
Control="Back"
Event="NewDialog"
Value="WelcomeDlg"
Order="2">1</Publish>
<Publish Dialog="InstallDirDlg"
Control="Next"
Event="NewDialog"
Value="VerifyReadyDlg"
Order="2">1</Publish>
<Publish Dialog="VerifyReadyDlg"
Control="Back"
Event="NewDialog"
Value="WelcomeDlg"
Order="2">1</Publish>
</UI>
<Property Id="LAUNCHAPPONEXIT" Value="1" />
</Product>
</Wix>
Fragment file for the Java Subfolders sample
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<?include AMyApp_Define_Paths.wxi ?>
<DirectoryRef Id="Java64BitDIR">
<Component Id="JAVA64BIT_Support" Guid="{GUID1a}">
<File Id="_64_javax.comm.properties" Source="$(var.Path_Java64Bit)\javax.comm.properties" />
</Component>
</DirectoryRef>
<DirectoryRef Id="Java64BitLibDIR">
<Component Id="JAVA64BITLIB_Support" Guid="{GUID2a}">
<File Id="_64_HardwireDriver.jar" Source="$(var.Path_Java64BitLib)\HardwireDriver.jar" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>
Fragment file for the common stuff installed at root folder
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" >
<Fragment>
<DirectoryRef Id="INSTALLDIR">
<Component Id="AMyApp_CORE" Guid="{GUID1c}" Win64="yes">
<?include AMyApp_Define_Paths.wxi ?>
<RegistryKey
Root="HKLM"
Key="SOFTWARE\AMyApp"
ForceCreateOnInstall="yes"
ForceDeleteOnUninstall="yes" >
<RegistryValue Type="string" Name="InstallDir" Value="[INSTALLDIR]"/>
<RegistryValue Type="string" Name="MyAppContext" Value="Testing"/>
</RegistryKey>
<RemoveFile Id="RemoveAllMyAppFiles" Name="*.*" On="uninstall" />
<RemoveFolder Id="INSTALLDIR" On="uninstall" />
<File Id="MyApp.exe" Source="$(var.Path_MyAppReleaseFolder)\MyApp.exe" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>
Here is a simplified work-around I came up with, but don't know why it does what it does under the hood, but works.
During the declaration of the <UI> segment, I just changed both "Welcome" and "MaintenanceWelcome" dialogs to both go to the "Install Directory" dialog. It apparently bypasses the route for "Repair" / "Uninstall" but WILL allow the installer to handle it's own delete of original and re-publish the new files from the installer.
<UI>
<UIRef Id="WixUI_InstallDir" />
<!--<Property Id="WixUI_Mode" Value="InstallDir" />-->
<!-- Skip license dialog -->
<Publish Dialog="WelcomeDlg"
Control="Next"
Event="NewDialog"
Value="InstallDirDlg"
Order="2">1</Publish>
<!-- Send the MAINTENANCE Dialog to the same Install Dir dialog -->
<Publish Dialog="MaintenanceWelcomeDlg"
Control="Next"
Event="NewDialog"
Value="InstallDirDlg"
Order="2">1</Publish>
...
</UI>

How can I execute a custom action in wix just before service installation?

This my Product.wxs:
In the custom action, I want to make changes in the httpd.conf file before Apache 2.4 service is installed, actually the Apache 2.4 Service takes Configuration parameters from httpd.conf, so its mandatory for the code that the changes should be made before installation of service, If any idea help me on this ?
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>
<Product Id="*" Name="MyExampleProject" Language="1033" Version="1.0.0.0" Manufacturer="Mq" UpgradeCode="08bd3c48-deef-4370-ab94-f8b4d49406e3">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<!--System Configuration Condition - Installation install only above Windows XP-->
<Condition Message="This application is only supported on Windows XP, or higher.">
<![CDATA[Installed OR (VersionNT >= 501)]]>
</Condition>
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='INSTALLDIR' Name='AgentFramework'>
<Directory Id='INSTALLBIN' Name='bin'/>
<Directory Id='INSTALLCONF' Name='conf'/>
<Directory Id='INSTALLMODULES' Name='modules'/>
</Directory>
</Directory>
</Directory>
<Feature
Id = "ProductFeature1"
Title = "AgentFramework"
Level = "1"
Absent="allow">
<ComponentRef Id='libapr_dll'/>
<ComponentRef Id='libapriconv_dll'/>
<ComponentRef Id='libaprutil_dll'/>
<ComponentRef Id='libhttpd_dll'/>
<ComponentRef Id='Pcre_dll'/>
<ComponentRef Id='Configurationfile'/>
<ComponentRef Id='Authzmodule'/>
<ComponentRef Id='Dirmodule'/>
<ComponentRef Id='ServiceComponent'/>
</Feature>
<DirectoryRef Id='INSTALLCONF'>
<Component Id='Configurationfile' Guid='2E0D2957-10EB-463A-A4FC-62B9062FE8A3'>
<File Id='Configurationfile' Name='httpd.conf' DiskId='1' Source='$(sys.CURRENTDIR)\httpd.conf' KeyPath='yes'>
</File>
</Component>
</DirectoryRef>
<DirectoryRef Id='INSTALLMODULES'>
<Component Id='Authzmodule' Guid='62AA97B6-7821-4CB4-9F89-B2A8FF0CC6BD'>
<File Id='Authzmodule' Name='mod_authz_core.so' DiskId='1' Source='$(sys.CURRENTDIR)\mod_authz_core.so' KeyPath='yes'>
</File>
</Component>
<Component Id='Dirmodule' Guid='9966BB3B-8296-43B9-A6DC-712561303329'>
<File Id='Dirmodule' Name='mod_dir.so' DiskId='1' Source='$(sys.CURRENTDIR)\mod_dir.so' KeyPath='yes'>
</File>
</Component>
</DirectoryRef>
<DirectoryRef Id='INSTALLBIN'>
<Component Id='libapr_dll' Guid='FB82D093-0B32-465B-8D8B-08B3127EB414'>
<File Id='libapr_dll' Name='libapr-1.dll' DiskId='1' Source='$(sys.CURRENTDIR)\libapr-1.dll' KeyPath='yes'>
</File>
</Component>
<Component Id='libapriconv_dll' Guid='667D6D5B-6FE4-4A6B-827F-C496239628E2'>
<File Id='libapriconv_dll' Name='libapriconv-1.dll' DiskId='1' Source='$(sys.CURRENTDIR)\libapriconv-1.dll' KeyPath='yes'>
</File>
</Component>
<Component Id='libaprutil_dll' Guid='72C688D2-8E25-49D9-9E76-F6BDBC33D394'>
<File Id='libaprutil_dll' Name='libaprutil-1.dll' DiskId='1' Source='$(sys.CURRENTDIR)\libaprutil-1.dll' KeyPath='yes'>
</File>
</Component>
<Component Id='libhttpd_dll' Guid='8946D5B1-0EA2-443E-8C20-CD8D877ACF75'>
<File Id='libhttpd_dll' Name='libhttpd.dll' DiskId='1' Source='$(sys.CURRENTDIR)\libhttpd.dll' KeyPath='yes'>
</File>
</Component>
<Component Id='Pcre_dll' Guid='0466BB2A-137C-4A95-A510-43E7A274F834'>
<File Id='Pcre_dll' Name='pcre.dll' DiskId='1' Source='$(sys.CURRENTDIR)\pcre.dll' KeyPath='yes'>
</File>
</Component>
<Component Id ="ServiceComponent" Guid="8A1BF3F0-8A84-456E-816A-5907B40B2DDB" >
<File Id='Applicationfile' Name='httpd.exe' DiskId='1' Source='$(sys.CURRENTDIR)\httpd.exe' KeyPath='yes'>
</File>
<ServiceInstall Id="ServiceComponent" Type="ownProcess" Name="Apache2.4"
DisplayName="Apache2.4" Description="Service"
Arguments="-k runservice" Start="auto" Account="LocalSystem" ErrorControl="normal"
Vital="yes" >
<util:PermissionEx User="Everyone" ServicePauseContinue="yes" ServiceQueryStatus="yes"
ServiceStart="yes" ServiceStop="yes" ServiceUserDefinedControl="yes" /> </ServiceInstall>
<ServiceControl Id="ServiceComponent" Start="install" Stop="both"
Remove="uninstall" Name="Apache2.4" Wait="yes" />
</Component>
</DirectoryRef>
<UIRef Id="CustomizeDlg" />
<UI Id="MyWixUI_Mondo">
<UIRef Id="WixUI_Mondo" />
<UIRef Id="WixUI_ErrorProgressText" />
<DialogRef Id="UserRegistrationDlg" />
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="UserRegistrationDlg" Order="3">LicenseAccepted = "1"</Publish>
<Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="UserRegistrationDlg">1</Publish>
</UI>
<Property Id="PIDTemplate"><![CDATA[1234<####-####-####-####>####]]></Property>
<CustomAction Id='CheckLogLevel' BinaryKey='CheckLogLevel' DllEntry='CustomAction1' />
<Binary Id ='CheckLogLevel' SourceFile='$(sys.CURRENTDIR)\MqAgent_LogLevel.dll'/>
<WixVariable Id="WixUIBannerBmp" Value="C:\Image\style39_banner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="C:\Image\style39_dialog.bmp" />
</Product>
</Wix>
Here's CustomizeDlg.wxs :
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI Id ="CustomizeDlg">
<ComboBox Property="SETUPLOGLEVEL">
<ListItem Text="Debug" Value="1" />
<ListItem Text="info" Value="2" />
<ListItem Text="warn" Value="3" />
</ComboBox>
<Dialog Id="UserRegistrationDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
<Control Id="NameEdit" Type="ComboBox" X="52" Y="48" Width="156" Height="10" ComboList="yes"
Property="SETUPLOGLEVEL" Sorted="no" RightToLeft="yes"/>
<Control Id="CDKeyLabel" Type="Text" X="45" Y="147" Width="50" Height="10" TabSkip="no">
<Text>CD &Key:</Text>
</Control>
<Control Id="CDKeyEdit" Type="MaskedEdit" X="45" Y="159" Width="250" Height="16" Property="PIDKEY" Text="[PIDTemplate]" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&Back">
<Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
<Text>Please mention the log level</Text>
</Control>
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
<Text>{\WixUI_Font_Title}Select Log Level</Text>
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
</Dialog>
</UI>
</Fragment>
</Wix>
What I've done before was put all my custom action's logic in an executable and then call the executable, which worked nicely. It turns out that WiX provides various Custom Action Projects within Visual Studio that remove the need to create a stand alone executable, see here for a nice example by James Schaffer.
As for controlling when the custom action is executed, you control this by adding an entry in the InstallExecuteSequence node of the *.wxs file, like this...
<InstallExecuteSequence>
<Custom Action="CheckLogLevel" Before="InstallServices" />
</InstallExecuteSequence>
... where CheckLogLevel is my custom action, and it's being directed to be run before the InstallServices action.
mattyB gets a big thumbs up.
To better understand this problem though I think it's important to view the MSI in Orca. Orca is a MS product which can view the lifecycle of MSI files. It also allows you to directly edit the MSI file.
Below is a screenshot of the "jobs" which will be run by the installer in sequence order. mattyB mentioned the "InstallServices" job, which I have highlighted in the screenshot below. We need to make sure all of our custom actions occur BEFORE this job runs. From here it's as simple as setting the "Before" attribute in the "Custom" tag to a value of "InstallServices."
Hopefully this helps to further demystify WiX.

Wix prorperies value don't value is not changed after radioButton section

I want to select in the office version, the default is 32 bits. But when being installed and checked the properties to copy files, select the default value, without considering my choice. How to fix it?
Product.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
>
<Product Id="{95B5E9E1-AB21-4947-A047-74C169B1D1F2}" Name="Xproduct" Language="1033" Version="1.0.0.0" Manufacturer="X Limited" UpgradeCode="af9969f2-fb9c-44c7-b207-e89f1d900a91">
<Package InstallerVersion="301" Compressed="yes" InstallPrivileges="elevated" InstallScope="perMachine" AdminImage="yes" Manufacturer="X Limited" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Property Id="officeVersion" Value="32"/>
<UI Id="MyWebUI">
<UIRef Id="WixUI_FeatureTree" />
<UIRef Id="WixUI_ErrorProgressText" />
<DialogRef Id="CheckVersion"/>
<Publish Dialog="LicenseAgreementDlg" Control="Next"
Event="NewDialog" Value="CheckVersion"
Order="3">LicenseAccepted = "1"</Publish>
</UI>
<Feature Id="CommonFuture" Title="xInstaller" Level="1">
<ComponentGroupRef Id="ShotcutComponents"/>
<ComponentGroupRef Id="xComponents"/>
<ComponentGroupRef Id="PocketSoapComponent"/>
<ComponentGroupRef Id="SystemComponentsWinX86" />
<ComponentGroupRef Id="SystemComponentsWinX64"/>
<ComponentGroupRef Id="SystemComponentsWinX64Office64"/>
</Feature>
</Product>
<Fragment>
<Condition Message="You need to be an administrator to install this product.">
Privileged
</Condition>
</Fragment>
<Fragment>
<InstallExecuteSequence>
<Custom Action='MyProcess.TaskKill' Before='InstallValidate'>NOT Installed</Custom>
</InstallExecuteSequence>
<Property Id="System32WindowsFolder" Value="C:\Windows\System32"/>
<Property Id="QtExecCmdLine" Value='"[WindowsFolder]\System32\taskkill.exe" /F /IM EXCEL.EXE'/>
<CustomAction Id="MyProcess.TaskKill" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="ignore"></CustomAction>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="SystemFolder" />
<Directory Id="System32WindowsFolder"/>
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="xAddin"/>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="xShorcutsDir" Name="xAddin"/>
</Directory>
<Directory Id="AppDataFolder">
<Directory Id="Microsoft" Name="Microsoft">
<Directory Id="AddIns" Name="AddIns"/>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="SystemComponentsWinX64" Directory="SystemFolder">
<Component Id="SystemDLL" Guid="{5CC58B1B-CF05-412B-A9DC-89C4D9DDA8E3}" >
<File Id="FILE_xXIDLL" Source="dll/system/xXlFunctions.dll" KeyPath="yes"/>
<Condition>officeVersion = 32 AND %PROCESSOR_ARCHITECTURE="AMD64"</Condition>
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="SystemComponentsWinX86" Directory="SystemFolder">
<Component Id="SystemDLLx86" Guid="{8F3B689F-EC06-43C9-AF87-47DB8534EC9D}" >
<File Id="FILE_xXIDLLx86" Source="dll/system/xXlFunctions.dll" KeyPath="yes"/>
<Condition>officeVersion = 32 AND %PROCESSOR_ARCHITECTURE="x86"</Condition>
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="SystemComponentsWinX64Office64" Directory="System32WindowsFolder">
<Component Id="SystemDLLx64" Guid="{569E68EB-9C6D-4B72-A811-429A6901B05A}" >
<File Id="FILE_xXIDLLx64" Source="dll/system/x64/xXlFunctions.dll" KeyPath="yes"/>
<Condition>officeVersion = 64 AND %PROCESSOR_ARCHITECTURE="AMD64"</Condition>
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="xComponents" Directory="AddIns">
<Component Id="xXLA" Guid="{BBDA689A-B48D-4B61-8A9F-50CB0B4BC9AA}" >
<File Id="FILE_xXLA" Source="xla/x.xla"/>
<RegistryValue Id="RegKeyxAddin" Root="HKCU"
Key="Software\Microsoft\Office\Excel\AddIns\aqillaaddin"
Name="xAddin"
Value="x Excel Add-In"
Type="string" KeyPath="yes" />
<RemoveFolder Id="RemoveAddInsFolder" On="uninstall" Directory="AddIns"/>
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="ShotcutComponents" Directory="xShorcutsDir">
<Component Id="UninstallShorcut" Guid="{BEECAC18-779F-4F6A-8D0B-2545626FD80A}">
<Shortcut Id="UninstallShorcut"
Name="Uninstall x Addin"
Description="Uninstall x Addin and all of its components"
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]" />
<RemoveFolder Id="RemoveMyApplication" On="uninstall"/>
<RegistryValue Root="HKCU"
Key="Software\Microsoft\xAddin"
Name="installed"
Type="integer"
Value="1"
KeyPath="yes"/>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
ChecKVersion.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<Dialog Id="CheckVersion" Width="370" Height="270" Title="[ProductName]" NoMinimize="yes" >
<!-- Virtual Dir prompt -->
<Control Id="Office32" Type="RadioButtonGroup" Property="officeVersion" Height="100" Width="200" X="50" Y="50">
<RadioButtonGroup Property="officeVersion">
<RadioButton Value="32" Text="Microsot Office Version 32bit" Height="17" Width="200" X="0" Y="0"/>
<RadioButton Value="64" Text="Microsot Office Version 64bit" Height="17" Width="200" X="0" Y="20"/>
</RadioButtonGroup>
</Control>
<!-- Back button -->
<Control Id="Back" Type="PushButton" X="180" Y="243"
Width="56" Height="17" Text="&Back">
<Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
</Control>
<Control Id="Install" Type="PushButton" X="236" Y="243"
Width="56" Height="17" Default="yes" Text="&Install" ElevationShield="yes">
<Publish Event="EndDialog" Value="Return" Order="1">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243"
Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0"
Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
<Control Id="Description" Type="Text" X="25" Y="23"
Width="280" Height="15" Transparent="yes" NoPrefix="yes">
<Text>Please select Microsoft Office Version</Text>
</Control>
<Control Id="BottomLine" Type="Line" X="0" Y="234"
Width="370" Height="0" />
<Control Id="Title" Type="Text" X="15" Y="6"
Width="200" Height="15" Transparent="yes" NoPrefix="yes">
<Text>{\WixUI_Font_Title}Microsoft Office select version</Text>
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
</Dialog>
</UI>
</Fragment>
</Wix>
And another problem when the system is 64 bit I can not copy the file to C:\Windows\System32. The system automatically overrides the folder in C: \ WINDOWS \ SysWOW64 \
Transformed into public property and it was considered
Use attribute “Secure” to denote that the Property can be passed to the server side when doing a managed installation with elevated privileges.
<Property Id="OFFICEVERSION" Secure="yes" Value="32"/>