I am trying to create multiple shortcuts to my application that pass different arguments on the commandline by using the Arguments
attribute of the Shortcut element. I want to be able to reference an existing property from another property in my WiX file.
I want to be able to create a shortcut by referencing the ARGUMENTS
property via:
<Component Id="MyAppProgramMenuShortcut" Guid="MY-GUID-HERE">
<RegistryValue Root="HKCU"
Key="Software\[Manufacturer]\[ProductName]\MyAppShortcut" Type="string"
Value="" KeyPath="yes" />
<Shortcut Id="ProgramMenuShortcutMyApp" Directory="ProgramMenuDir"
Name="MyApp" Target="[SHORTCUT_TARGET]"
Arguments="-jar myApp.jar [ARGUMENTS]" WorkingDirectory="INSTALLDIR"
Icon="logo.ico" />
</Component>
I've tried something equivalent to:
<Property Id="PROGRAM_FILES">C:\Program Files</Property>
<Property Id="MY_APP_DIR">[PROGRAM_FILES]\MyApp</Property>
<Property Id="ARGUMENTS">[MY_APP_DIR]\fileA.xml [MY_APP_DIR]\fileB.xml</Property>
but then I get this warning when passing it through candle.exe:
warning CNDL1077 : The 'MY_APP_DIR' Property contains '[PROGRAM_FILES]' in its value which is an illegal reference to another property. If this value is a string literal, not a property reference, please ignore this warning. To set a property with the value of another property, use a CustomAction with Property and Value attributes.
So, based on the suggestion in the warning I switched to something equivalent to:
<CustomAction Id="PROGRAM_FILES" Property="PROGRAM_FILES" Value="C:\Program Files"/>
<CustomAction Id="MY_APP_DIR" Property="MY_APP_DIR" Value="[PROGRAM_FILES]\MyApp"/>
<CustomAction Id="ARGUMENTS" Property="ARGUMENTS" Value="[MY_APP_DIR]\fileA.xml [MY_APP_DIR]\fileB.xml"/>
and I get no warnings or errors, but the problem is that when I install the application the shortcuts don't have the arguments in the target field.
Am I not doing something that I should be doing? Is there a way to do what I want to do?