0
votes

I am fairly new to WiX and installers so please bear with me on this question.

I have created a WiX Setup project to install my C# application and I have been able to get it to successfully install with the folder in the Programs Files folder and shortcuts to the desktop and Applications Program folder.

My problem is when I uninstall the program either using the msi the setup project generated or the uninstall option in add/remove programs the shortcuts still remain and the application is still in the Programs Files folder. Here is my code:

<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLFOLDER" Name="Update Tool" />
  </Directory>
  <Directory Id="ProgramMenuFolder">
    <Directory Id="ApplicationProgramsFolder" Name="Update Tool" />
  </Directory>
  <Directory Id="DesktopFolder" Name="Desktop"/>
</Directory>

  <Fragment>
<DirectoryRef Id="ApplicationProgramsFolder">
  <Component Id="ApplicationShortcut" Guid="*">
    <Shortcut Id="ApplicationStartMenuShortcut"
              Name="Update Tool"
              Description="Update Tool"
              Target="[INSTALLFOLDER]Updater.exe"
              WorkingDirectory="APPLICATIONROOTDIRECTORY"
              Icon="icon.ico"/>
    <RemoveFile Id="remove_menushortcut" Name="Update Tool" On="uninstall"/>
    <RemoveFolder Id="RemoveApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall"/>
    <RegistryValue Root="HKCU" Key="Software\Microsoft\Update Tool" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
  </Component>
</DirectoryRef>
<DirectoryRef Id="DesktopFolder">
  <Component Id="ApplicationShortcutDesktop" Guid="*">
    <Shortcut Id="ApplicationDesktopShortcut"
              Name="Update Tool"
              Description="Update Tool"
              Target="[INSTALLFOLDER]Updater.exe"
              WorkingDirectory="APPLICATIONROOTDIRECTORY"
              Icon="icon.ico"/>
    <RemoveFile Id="remove_applicationshortcut" Name="Update Tool" On="uninstall"/>
    <RemoveFolder Id="RemoveDesktopFolder" Directory="DesktopFolder" On="uninstall"/>
    <RegistryValue Root="HKCU" Key="Software\Microsoft\Update Tool" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
  </Component>
</DirectoryRef>

Can anyone point out what it is I am doing wrong or what I need to have in? Thanks

1

1 Answers

0
votes

Multiple Instances?: In Add / Remove programs, are there more than one entry for your application? If so, please try to uninstall all of them and see if the shortuct items and files disappear. Bear in mind that these could include "experimental instances" that you no longer recall. Try on a clean virtual to see if uninstall cleans up properly there after a fresh install.

Updater.exe: I see you have an "Updater.exe" in there. Are you downloading the application files from a server using that EXE file to kick off the process? If so, then this is not intended use of MSI and WiX. Downloading files from a share ignores important deployment functionality such as transaction control, rollback, file registration, file inventory, etc... If you are going to download files like this, you might as well deploy the shortcuts using a non-MSI technology.