I am trying to create a shortcut from an exe to the StartMenuFolder
and DesktopFolder
using Wix v4 for a Heat Harvested application.
Using this, my desired behavior is that I can add a Shortcut
to an exe from the HarvestedComponents
gathered by the HarvestGroup
denoted below from my .wixproj file in both the DesktopFolder
and StartMenuFolder
.
<HarvestDirectory Include="../harvestDirectory/">
<ComponentGroupName>HarvestedComponents</ComponentGroupName>
<DirectoryRefId>INSTALLFOLDER</DirectoryRefId>
<SuppressRootDirectory>true</SuppressRootDirectory>
</HarvestDirectory>
In the Package.wxs
, I tried to create a Component containing a Shortcut referencing the INSTALLFOLDER, however giving it a Target and Advertise='yes'
result in an error saying that the Target and Advertise cannot be specified together. I would understand this behavior if I were able to set the file of the Shortcut beforehand, as seen in the streams from Rob Mensching going over Wix v4.
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<Package Name="App 1.0.0.0" Manufacturer="Manufacturer" Version="1.0.0.0"
UpgradeCode="{Guid}">
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
<WixVariable Id="WixUILicenseRtf" Value="Include/License.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="Include/banner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="Include/image.bmp" />
<MediaTemplate EmbedCab="yes" />
<ui:WixUI Id="WixUI_InstallDir" InstallDirectory="INSTALLFOLDER" />
<Feature Id="Main">
<ComponentGroupRef Id="HarvestedComponents" />
<ComponentRef Id="ShortcutsSetup" />
</Feature>
<Component Id="ShortcutsSetup" Directory="INSTALLFOLDER" Guid="{Guid}">
<Shortcut Id="StartMenuShortcut" Directory="StartMenuFolder" Target="App.exe"
Name="App 1.0.0.0" Advertise="yes" WorkingDirectory="INSTALLFOLDER"/>
</Component>
</Package>
</Wix>
The Target
attribute is for a non-advertised Shortcut according to the documentation here, so you can't use Target
and Advertise="yes"
together. If you want to use Advertisement, choose Advertise=yes
and drop the Target
. Otherwise, do the opposite.