A couple comments on what you have here:
1) Component/@Id and File/@Id values must be unique (it isn't obvious which
feature you are including (the one from test2.wxs or test3.wxs) when you
build. I'm surprised you are not getting an error.
2) The wix.chm file clearly describes the Condition element and how it is
used under Feature and Component elements to specify their conditions.

As to your question about conditioning additional "features and custom
actions" on the presence of a registry key, look up the RegistrySearch
element.

-----Original Message-----
From: Yu, Brian [mailto:b...@easyscreen.com] 
Sent: Friday, August 21, 2009 8:44 AM
To: General discussion for Windows Installer XML toolset.
Subject: [WiX-users] Install File Shortcut based on registry value

I want to install file shortcuts based on a value in registry, can it be
done?

 

If HKLM\software\myapp\myKey1 exists, then don't install shortcut

If HKLM\software\myapp\myKey2 exists, then install shortcut

 

How can I add conditions to components and features? Do I have to use
custom actions? If so, any examples?

 

In test1.wxs

<Feature Id='Binaries' Title='Deploy Binaries' Description='Deploy
Binary Files' Level='1'>

<ComponentRef Id='File1dll' />

</Feature>

 

In test2.wxs - where shortcut is created

<Component Id='file1dll' Guid='ad42bd82-ac90-48f2-8db8-eab8a3921018'>


                                <File Id="file1.dll" 

                                                Name=" file1.dll " 

                                                Source="Normal\file1.dll
" 

                                                KeyPath="yes"

                                                Vital="yes">

                                                

                                                <Shortcut
Advertise="yes" Id="MyMenuShortcut" Directory=" dirMyCalc "
Name="MyCalc"

 
WorkingDirectory="MyCalcBin" >

                                                                <Icon
Id="Myicondll" SourceFile="Normal\file1.dll" />

                                                </Shortcut>

                                                <Shortcut
Advertise="yes" Id="MyDeskTopShortcut" Directory="DesktopFolder"
Name="Launch MyFile"

 
WorkingDirectory=" MyCalcBin " >           

                                                <Icon Id="etdesktop.exe"
SourceFile="Normal\file1.dll" />

                                                

                                                </Shortcut>


                                </File>

                

                                <RemoveFolder Id="DeleteMyMenuShortcut"
Directory=" dirMyCalc " On="uninstall" />             

                                <RemoveFolder
Id="DeleteMyDeskTopShortcut" Directory="DesktopFolder" On="uninstall" />


                                <RemoveFolder Id="MyProgramMenuDir"
Directory="ProgramMenuDir" On="uninstall" />

                </Component>    

 

In test3.wxs - where shortcut is NOT created

<Component Id='file1dll' Guid='ad42bd82-ac90-48f2-8db8-eab8a3921018'
KeyPath="yes">

<File Id="file1.dll" Name=" file1.dll " Source="Normal\file1.dll ">

 

 

Another thing I want to do is this

If HKLM\software\myapp\myvalue does not exist, run extra features and
custom actions?

 

 

 

Regards

Brian Yu

 

 


_____________________________________________________________________
This e-mail was sent to you by EASYSCREEN LIMITED (EASYSCREEN). We are
incorporated under the laws of England and Wales (company no. 05677531 and
VAT registration no. 872810613). Our registered office is at 155
Bishopsgate, London EC2M 3TQ. This e-mail and/or any attached documents may
contain privileged and confidential information and should only be read by
those persons to whom this e-mail is addressed. Use by other than intended
recipients is prohibited. If you are not the addressee, you must not copy,
distribute, disclose or use any of the information in it. If you have
received it in error, please delete it and immediately notify the sender.
EASYSCREEN reserves the right to monitor all e-mail messages passing through
its network. As we cannot guarantee the genuineness, accuracy or
completeness of the information contained in this message, the statements
set forth are not legally binding.
----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus
on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to