Search code examples
visual-studio-2008wixwix3

Wix doesn't remove the shortcuts on uninstall in VS 2008


for some reason the Wix shortcut is not removed on uninstall.

this is my code:

  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLDIR" Name="App">

      <Component Id="AppExecutable" DiskId="1" Guid="12854481-BE33-4733-8B46-FDB424057C9A">
        <File Id="App1ExecutableFile" Source="$(var.RESOURCEDIR)\App.exe" KeyPath="yes">
        </File>
      </Component>

    </Directory>
  </Directory>

  <Directory Id="ProgramMenuFolder" Name="PMFiles">
    <Directory Id="AppShortcutDirectory" Name="App for OS">

      <Component Id="App1Shortcuts" DiskId="1" Guid="">
        <RegistryValue Root="HKCU" Key="[ApplicationRegistryPath]\MsiInstaller\GuestShortcutsAreInstalled" Type="string" Value="" KeyPath="yes" />

        <Shortcut Id="App1ExecutableShortcut" Directory="AppShortcutDirectory"
                  Target="[#App1ExecutableFile]" Name="App"
                  WorkingDirectory="INSTALLDIR" Description="Run the App" Advertise="no" />

        <RemoveFolder Id="DelteShortcutFolder1" Directory="AppShortcutDirectory" On="uninstall" />

      </Component>
    </Directory>
  </Directory>

thanks!


Solution

  • The Guid of the component where shortcut resides is empty string. Take a look what documentation says about it:

    It's also possible to set the value to an empty string to specify an unmanaged component. Unmanaged components are a security vulnerability because the component cannot be removed or repaired by Windows Installer (it is essentially an unpatchable, permanent component).

    So, place a valid GUID there or just '*' to fix this.