I have a property for whether to install shortcuts that need to be passed via command line arguments. The conditions seem to work when I set the properties within the wxs file, but they seem to be ignored when setting them through the command line. From the log I see that they are being set:
MSI (s) (24:C8) [11:01:32:234]: PROPERTY CHANGE: Modifying INSTALLSTARTUPSHORTCUT property. Its current value is '0'. Its new value: '1'.
MSI (s) (24:C8) [11:01:32:234]: PROPERTY CHANGE: Modifying INSTALLSTARTMENUSHORTCUT property. Its current value is '0'. Its new value: '1'.
MSI (s) (24:C8) [11:01:32:234]: PROPERTY CHANGE: Modifying INSTALLDESKTOPSHORTCUT property. Its current value is '0'. Its new value: '1'.
However, they the shortcuts aren't being installed.
Also, it seems like since they need to be in their own component to be able to set conditions on them, they can no longer be advertised shortcuts. How would you get conditionally installed advertised shortcuts?
Current shortcut code:
<Property Id="INSTALLSTARTMENUSHORTCUT" Value="0"/>
...
<Component Id="StartMenuShortcut" Guid="MY-GUID">
<Condition>INSTALLSTARTMENUSHORTCUT</Condition>
<Shortcut Id="StartMenuServerShortcut"
Directory="ProgramMenuDir"
Name="Application Name" WorkingDirectory="INSTALLDIR" Advertise="no"
Target="[!FileEXE]"
Icon="Icon.ico" />
</Component>
And repeated for other shortcuts
Edit:
Trying what Sacha suggested and adding the following:
<Property Id="INSTALLSTARTUPSHORTCUT" Value="0" Secure="yes"/>
<Property Id="INSTALLDESKTOPSHORTCUT" Value="0" Secure="yes"/>
<Property Id="INSTALLSTARTMENUSHORTCUT" Value="0" Secure="yes"/>
Now it installs all the shortcuts even though they're set to 0 both in the xml and on the command line. The command line I'm passing is:
msiexec /i MySetup.msi INSTALLSTARTUPSHORTCUT=0 INSTALLDESKTOPSHORTCUT=0 INSTALLSTARTMENUSHORTCUT=0 /l*v inst.log /qb
tried putting the values in quotes and still no go. Not shown here, but I was successful in manipulating the ALLUSERS property to do per-user or per-machine registries by doing ALLUSERS="" or ALLUSERS="2" So passing in properties should be possible, but I'm not sure what I'm doing wrong.
Two things since there are two questions here:
I have a blog post about how to create a shorcut and pass validation.
The Properties you are using need to be marked secure to pass from the install UI process to the server-side. To do that just do
<Property Id="INSTALLSTARTMENUSHORTCUT" Secure="yes"/>
Notice that I did not add a Value attribute. If you specify a Value, even if it is 0, then your INSTALLSTARTMENUSHORCUT will evaluate to TRUE. A blank/non-defined Property is FALSE, any other value is TRUE.
Have you tried marking the properties as secure?
<Property Id="INSTALLSTARTMENUSHORTCUT" Value="0" Secure="Yes" />
Looking at the documentation for the Shortcut Table I don't think you can get conditionally advertised shortcuts. We get around this by installing an Advertised start menu shortcut, and a regular desktop shortcut.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With