I Cannot retrieve ARPINSTALLLOCATION so we know where to install a new version
I am trying to retrieve the ARPINSTALLLOCATION during the installation of a Major Upgrade version of the software.
Following this info I managed to set the ARPINSTALLLOCATION to the custom path.
However, retrieving it again isn't working. I've tried many things over the past days but it keeps defaulting back to the default installation path instead of the custom one.
<InstallUISequence>
<AppSearch After="FindRelatedProducts"/>
...
</InstallUISequence>
<Property Id="WIXUI_INSTALLDIR" Value="APPROOTDIRECTORY">
<RegistrySearch Id="FindInstallLocation"
Root="HKLM"
K开发者_运维技巧ey="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
Name="InstallLocation"
Type="raw" />
</Property>
In the custom WixUI_InstallDir UI I have this in the CustomInstallDirDlg
<Control Id="Folder" Type="PathEdit" X="20" Y="90" Width="260" Height="18" Property="WIXUI_INSTALLDIR" Indirect="yes" />
The alternative install path is in the registry, but it isn't retrieved and shown in the control. What am I doing wrong here?
-Birkoff
Thank you sascha. We your help I was able to make some changes and am now able to retrieve the value from the registry. I don't really understand why you would set ARPINSTALLLOCATION and don't use it afterwards again, so I modified my code like this:
<InstallUISequence>
<FindRelatedProducts Before="AppSearch"/>
...
</InstallUISequence>
<Property Id="APPROOTDIRECTORY" Secure="yes">
<RegistrySearch Id="FindInstallLocation"
Root="HKLM"
Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
Name="InstallLocation"
Type="raw" />
</Property>
<Property Id="WIXUI_INSTALLDIR" Value="APPROOTDIRECTORY" />
The setup now correctly retrieves the previous installed location. Hopefully this is of any help to others aswell.
From memory (and what we do) best practice is to save the installation location to our own registry key. We also write ARPINSTALLLOCATION
, but never try to read from it. Here's an example from our production code that's designed to work with a default nested install location (i.e. Program Files\Company\Application\
) and is working fine for both UI and silent install, upgrade, etc.
<!-- Look for previously saved install location -->
<Property Id="APPLICATIONFOLDER" Secure="yes">
<RegistrySearch Id="RegSearch_APPLICATIONFOLDER" Root="HKLM" Key="SOFTWARE\ACME\MyApp" Name="installpath" Type="raw" />
</Property>
<!-- Set UI default for fresh install -->
<Property Id="ApplicationFolderName" Value="ACME\MyApp" />
<!-- Overwrite variable to avoid runtime error -->
<Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONFOLDER" />
<!-- Directory structure(s) -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="ACME" Name="ACME">
<Directory Id="APPLICATIONFOLDER" Name="MyApp" DiskId="1">
<!-- ... -->
</Directory>
</Directory>
</Directory>
</Directory>
精彩评论