I’m beginning with WiX and I have some trouble to customize ExitDIalog.
At first what I want:
I want to create a setup for my application
After setup I want to propose 2 choices :
Launch application (application.exe newly installed)
Launch an optional setup (my application require to install some drive depending of user’s camera)
The optional setup is a .exe. It should be placed next to setup.msi but no copied in my application folder.
I created directories :
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="$(var.compagny)"/>
</Directory>
<Directory Id="DesktopFolder" SourceName="Desktop"/>
<Directory Id="ProgramFilesFolder">
<Directory Id="COMPAGNYFOLDER" Name="$(var.compagny)">
<Directory Id="INSTALLFOLDER" Name="$(var.product)">
<Directory Id="fr" Name="fr"/>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
How can I add a reference to my .exe ? I did :
<Component Id="ProductComponent" Guid="{2C26B191-6654-4405-8E78-F8B6EFEDC9FC}" Directory="INSTALLFOLDER">
<File Id="uEye64_47100_WHQLexe" Source="./Resources/uEye64_47100_WHQL.exe" KeyPath="yes" Checksum="yes" Compressed="no" Vital="no"/>
</Component>
But the uEye64_47100_WHQL.exe file is copied in INSTALLFOLDER (I don't want) and the setup mix the path with [application]/bin/Release (don't know with). In the log file there is :
Failed to open the file:C:\dev\MyApplication\main\SetupProject\bin\Release\MyCompagny\MyProduct\uEye64_47100_WHQL.exe for computing its hash. Error:3
And I call the .exe like this (this file require elevated privileges)
<!-- Set checkbox for launch install uEye -->
<Property Id="WIXUI_EXITDIALOGUEYECHECKBOXTEXT" Value="Launch install uEye"/>
<CustomAction Id="SetExecUEye" FileKey="uEye64_47100_WHQLexe" ExeCommand="" Return="asyncNoWait" Impersonate="no" Execute="deferred"/>
<UI>
<UIRef Id="WixUI_Custom"/>
<Publish Dialog="MyExitDialog"
Control="Finish"
Event="DoAction"
Value="SetExecUEye">WIXUI_EXITDIALOGUEYECHECKBOX = 1 and NOT Installed</Publish>
</UI>
How should I define my uEye64_47100_WHQL.exe to be called after setup but no copied in INSTALLFOLDER ?
If you don't want to copy file to install location, just run it, you can include it as Binary source instead of component. This way, it is packed in installer, but is not deployed on installation (probably to some temp folder only).
<Binary Id="uEye64_47100_WHQLexe" SourceFile="./Resources/uEye64_47100_WHQL.exe" />
<CustomAction Id="InstalluEye64exe" BinaryKey="uEye64_47100_WHQLexe" ExeCommand="" Execute="deferred" Return="ignore" Impersonate="no"/>
Related
I have Wix Code which simply installs a txt file in the given location
The target location is enclosed in a Property THISONE
<Fragment>
<Property Id="THISONE" Value="C:\MyFolder"/>
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='APPLICATIONFOLDER' ComponentGuidGenerationSeed="{75266e3e-3781-47e3-ac29-46a2d90548f9}">
<Directory Id='MyFolder' Name='MyFolder'/>
</Directory>
</Directory>
<SetDirectory Id='APPLICATIONFOLDER' Value='[THISONE]' />
</Fragment>
<Fragment>
<Component Id="Component1" Directory="MyFolder" Win64="yes">
<File Id="FirstFile.txt"/>
</Component>
</Fragment>
I want a minimal UI with maybe just a textbox where I can edit the property value so that I can change the target installation file path.
How can I achieve that ?
Thanks in Advance
The WiXUIInstallDir may be what you want, as described in the WiX documentation.
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='APPLICATIONFOLDER' ComponentGuidGenerationSeed="{75266e3e-3781-47e3-ac29-46a2d90548f9}">
<Directory Id='MyFolder' Name='MyFolder'/>
</Directory>
</Directory>
<Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONFOLDER" />
<UIRef Id="WixUI_InstallDir" />
You must set the value of the property WIXUI_INSTALLDIR to the value of the ID of the directory you want the user to be able to specify the location of, as shown above. This is then passed to the WixUI_InstallDir dialog. Note that the directory ID must all be uppercase.
If you're using Visual Studio, you'll need to add a reference to WixUIExtension to your WiX project. See here for more details.
I am struggling with Wix installer. During the install, the INSTALLDIR is overridden to a custom folder (not in Program Files). When I uninstall, the INSTALLDIR and the TARGETDIR gets set to E:\ no matter what I do.
How do I fix this? Here are the relevant snippets:
<Property Id="ARPINSTALLLOCATION">
<RegistrySearch Id="GetINSTALLDIRFromRegistry" Root="HKLM"
Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[ProductCode]" Name="InstallLocation" Type="raw" />
</Property>
<SetDirectory Id="TARGETDIR" Value="[ARPINSTALLLOCATION]">Installed</SetDirectory>
<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="CreateFolders" Sequence="execute">NOT Installed</SetProperty>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLDIR" Name="WinApp">
</Directory>
</Directory>
</Fragment>
Thanks in advance. I am using Wix Tools 3.10.
Update 1
Here are my findings (for now. please correct me as I am still new to Wix)
Contrary to popular belief, the installer does not seem to set the install folders automatically during uninstall.
An important exception to the above rule is when the install folders are "well known" folders like ProgramFilesFolder.
So, If you set your directory structure to this:
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLDIR">
<Directory Id="TEST" Name="WinApp" />
</Directory>
</Directory>
</Fragment>
You must set the INSTALLDIR directory through a property assignment or through a custom action. For example:
<Property Id="INSTALLDIR"><![CDATA[C:\mydir1\mydir1]]></Property>
If you set INSTALLDIR dynamically through a dialog box, you must read it from the registry or from a file (where you stored it during the install).
Update 2
Slightly improved version
<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" Sequence="execute" After="InstallFiles" />
<Property Id="INSTALLDIR" Secure="yes">
<RegistrySearch Id="Locate_EXISTINGINSTALLDIR" Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[ProductCode]" Name="InstallLocation" Type="directory" />
</Property>
<CustomAction Id="SetTARGETDIR"
Directory="TARGETDIR"
Value="[INSTALLDIR]"
Return="check" />
<InstallExecuteSequence>
<!--this action launches a window to allow the user to choose the folder. don't want
to use standard MSI/Wix dialogs as the functionality is limited
-->
<Custom Action='SelectFolderCustomAction' Before='CreateFolders'>NOT Installed</Custom>
<!--<Custom Action='RegistrationInfoCustomAction' Before='InstallFinalize'>NOT Installed</Custom>-->
<!--<Custom Action='UninstallCustomAction' Before='RemoveFiles'>Installed AND REMOVE = "ALL"</Custom>-->
<Custom Action="SetTARGETDIR" Before="RemoveFiles">Installed AND REMOVE = "ALL"</Custom>
</InstallExecuteSequence>
I dont understand what you are trying to do above. Why are you reading the install location from the registry?
This is what I do for installing to "D:\Program Files" folder.
<Property Id="ROOTDRIVE"><![CDATA[D:\]]></Property>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles" Name="Program Files">
Remove the SetDirectory element, it's obsolete. When the product is already installed, Windows Installer automatically sets the directory properties to the pathes of the actual installation directories.
The RegistrySearch for ARPINSTALLLOCATION looks strange too. Normally this property should only be set during first install, which you already do by using the SetProperty element.
So the following should be enough:
<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="CreateFolders" Sequence="execute">NOT Installed</SetProperty>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLDIR" Name="WinApp"/>
</Directory>
</Fragment>
We have the following folder structure in our wix declaration:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="$(var.ProgramFilesFolder)">
<Directory Id="ManufacturerFolder" Name="$(var.Manufacturer)">
<Directory Id="APPLICATIONFOLDER" Name="$(var.AppFolderName)">
// further folders or files
</Directory>
</Directory>
</Directory>
</Directory>
Target: We want to delete the APPLICATIONFOLDER on an uninstall. RemoveFolderEx and RemoveFolder will not work for this task, so we need to use a CustomAction. The CustomAction:
<CustomAction Directory="ManufacturerFolder" ExeCommand='/c rmdir /S /Q "[APPLICATIONFOLDER]"' Id="RemoveAppFolder" Execute="deferred" Impersonate="no" Return="ignore"/>
This custom action deletes nothing. What is the correct declaration?
Why Don't you do it like this?
It must work on uninstall.
For example just place it in component where you have shortcut creation.
<RemoveFolder
Id="rem_folder"
Directory="APPLICATIONFOLDER"
On="uninstall"/>
<RemoveFile Id="rem_files"
On="uninstall"
Directory="APPLICATIONFOLDER"
Name="*.*"/>
Using WiX 3.7, I have figured out how to create a folder in the root. This
<Directory Id="ReceivedFilesDir" Name="ReceivedFiles">
<Component Id="ReceivedFilesComponent" Guid="84A264EF-2BC5-41e3-8124-2CA10C2805DB">
<CreateFolder Directory="ReceivedFilesDir">
<Permission User="Administrators" GenericAll="yes" />
</CreateFolder>
</Component>
</Directory>
creates a folder C:\ReceivedFiles
I want it to be at D:\ReceivedFiles instead.
How do I achieve that?
I have played around with the DiskId attribute, but it did not seem to do anything.
Also, I don't want to change the whole installation folder, the ordinary part of the installation will still be below C:\Program Files (x86). I just want to create additional folders on D:.
Here's the solution we used for basically the same need:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="CROOT" Name="root">
<Directory Id="MY_CROOT" Name="PLACE_HOLDER">
<!-- Define C directory -->
</Directory>
</Directory>
<Directory Id="TROOT" Name="root">
<Directory Id="MY_TROOT" Name="PLACE_HOLDER">
<!-- Define T directory -->
</Directory>
</Directory>
</Directory>
<CustomAction Id="SetCRootDirectory" Property="CROOT" Value="C:\" />
<CustomAction Id="SetTRootDirectory" Property="TROOT" Value="T:\" />
<InstallExecuteSequence>
<Custom Action="SetCRootDirectory" Before="AppSearch" />
<Custom Action="SetTRootDirectory" Before="AppSearch" />
</InstallExecuteSequence>
You could add this to a UI sequence if your install takes advantage of that. You may need to set the Custom Action Before values to some other value given how all the rest of your sequences are defined. Hope this is useful.
Below xml creates the specified folders under C:\Programfiles but I want to create (SomeFolder\MyApp) Folders in D:\MySetupFolder\, how can I create this using the WIX?
<Directory Id="TARGETDIR" Name="SourceDir">
**<Directory Id="$(var.PlatformProgramFilesFolder)">**
<Directory Id="INSTALLFOLDERLOCATION" Name="SomeFolder">
<Directory Id="INSTALLLOCATION" Name="MyApp">
</Directory>
</Directory>
</Directory>
Set the value of rootdrive to the drive you want
<CustomAction Id='SetRootDrive' Property='ROOTDRIVE' Value='[%SystemDrive]\'/>
System drive will be by default the default drive used by OS
Added code to call 'SetRootDrive' action: You need to call it from InstallUISequence
<InstallUISequence>
<Show Dialog="MyWelcomeDlg" Before="CostFinalize">NOT Installed</Show>
<!-- App search is what does FindInstallLocation, and it is dependent on FindRelatedProducts -->
<AppSearch After="FindRelatedProducts"/>
<Custom Action="SetRootDrive" Before="CostInitialize"></Custom>
</InstallUISequence>