WiX - How to create a delete shortcut for all users?

This is not a question, but an answer. One part of the problem is available here: How to set program shortcuts for all users?
Quote:
"... How can I let the installer create a shortcut in the" All Users "profile so that everyone on the computer has a shortcut?"
The other is here: Wix creates a non-advertised shortcut for all users / per machine
Quote:
"... The tutorials I saw use the registry value for the key shortcut path. The problem is that they use HKCU as the root ..."

The main difficulty in creating the delete shortcut.

The solution is based on Rob Menshing's blog post. How to create a delete shortcut (and pass the entire ICE check) .

<!-- Script from Rob Menching blog post --> <?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product Id="PUT-GUID-HERE" UpgradeCode="PUT-GUID-HERE" Name="TestUinstallShortcut" Language="1033" Version="1.0.0" Manufacturer="Microsoft Corporation"> <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> <Media Id="1" /> <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramMenuFolder"> <Directory Id="ShortcutFolder" Name="My Application"> <Component Id="UninstallShortcutComponent" Guid="PUT-GUID-HERE"> <RegistryKey Root="HKCU" Key="Software\[UpgradeCode]"> <RegistryValue Value="RobMen Was Here." Type="string" KeyPath="yes" /> </RegistryKey> <Shortcut Id="UninstallProduct" Name="Uninstall My Application" Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]" Directory="ShortcutFolder" Description="Uninstalls My Application" /> <RemoveFolder Id="RemoveShorcutFolder" On="uninstall" /> </Component> </Directory> </Directory> </Directory> <Feature Id="TestUninstallShortcut" Title="Test Uninstall Shortcut Feature" Level="1"> <ComponentRef Id="UninstallShortcutComponent" /> </Feature> <CustomAction Id="LaunchApp" Directory="TARGETDIR" ExeCommand="[System64Folder]reg.exe Delete HKCU\Software\[UpgradeCode] /f" /> <InstallExecuteSequence> <Custom Action="LaunchApp" After="InstallFinalize">(NOT Installed) OR UPGRADINGPRODUCTCODE</Custom> </InstallExecuteSequence> </Product> </Wix> 

In this example:
In the added "Package" element InstallScope ="perMachine"
Changed registry key "Software\[UpgradeCode]"
Added CustomAction LaunchApp to remove an unnecessary registry key.

Tested on WinXP 32bit and Win7 64bit.

+4
source share

All Articles