installer - Detecting the presence of a directory at install time -
in wix directorysearch
can used determine if specific directory exists on target computer. don't understand if there's consistent way determine directory does not exist.
for example:
<property id="installdir" secure="yes"> <registrysearch id='installdir' type='directory' root='hklm' key='software\company\product\install' name='installpath'/> </property> <property id='is_installed' secure='yes'> <directorysearch id='isinstalled' path='[installdir]' /> </property>
when both registry key , directory exist, is_installed
property set path returned directorysearch
.
when directory not exist, is_installed
appears set "c:\".
is condition like:
<condition>not (is_installed = "c:\")</condition>
a reliable way detect directory found? there better way?
answer: here wix code based on mrnxs answer accepted
<property id="product_is_installed" secure="yes"> <registrysearch id='registrysearch1' type='directory' root='hklm' key='software\company\product\version\install' name='path'> <directorysearch id='directorysearch1' path='[product_is_installed]'/> </registrysearch> </property> <customaction id='set_installdir' property='installdir' value='[product_is_installed]'/> <installexecutesequence> <custom action='set_installdir' after='appsearch'></custom> </installexecutesequence>
usually happens when property used property-based folder. in case costfinalize action automatically sets property valid path (for example "c:\") folder can used windows installer.
since path generated automatically, cannot sure "c:\" on client machines, shouldn't use value in condition. instead, can try this:
- use custom property folder
- use type 51 custom action (property set formatted text) set property valid default path (for example "[programfilesfolder]mycompany\myproduct")
- use property search
- use type 51 custom action set folder property search property
for example, if search is_installed folder can use is_installed_path. is_installed_path can set default path , after appsearch action can set is_installed if search found something.
this way can use conditioning:
is_installed
or
not is_installed
Comments
Post a Comment