Wix setup - How to define uninstall
<p>I have created a my first Wix Setup to my C# project (i'm beginner with wix).</p>

<p>The setup create a msi file, this file works good. After setup all DLL and .exe are created in "C:\Program Files (x86)\MyApplication"</p>

<p>But when I right click on msi and select uninstall, a uninstall menu is displayed without error but folder "C:\Program Files (x86)\MyApplication" is not removed.</p>

<p>How can I define uninstall function to remove this folder ?</p>

<p>There is a part of my Product.wxs</p>

<pre><code>&lt;Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"&gt;
  &lt;Product Id="*"
           Name="My Application"
           Language="1033"
           Version="1.0.0.0"
           Manufacturer="Me"
           UpgradeCode="36944ae1-9e9f-4ef0-a860-9d894e0c28ef"&gt;
    &lt;Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"/&gt;
    &lt;MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed."/&gt;
    &lt;Media Id="1" Cabinet="myApplication.cab" EmbedCab="yes"/&gt;

    &lt;Feature Id="ProductFeature" Title="My Application" Level="1"&gt;
      &lt;ComponentGroupRef Id="ProductComponents"/&gt;
      &lt;ComponentRef Id ="ApplicationShortcut"/&gt;
      &lt;ComponentRef Id ="ApplicationShortcutDesk"/&gt;
      &lt;ComponentRef Id ="RemoveAll"/&gt;
    &lt;/Feature&gt;
  &lt;/Product&gt;

  &lt;Fragment&gt;
    &lt;Directory Id="TARGETDIR" Name="SourceDir"&gt;
      &lt;Directory Id="ProgramMenuFolder"&gt;
        &lt;Directory Id="ApplicationProgramsFolder" Name="My Application"/&gt;
      &lt;/Directory&gt;
      &lt;Directory Id="DesktopFolder" SourceName="Desktop"/&gt;
      &lt;Directory Id="ProgramFilesFolder"&gt;
        &lt;Directory Id="INSTALLFOLDER" Name="My Application"&gt;
          &lt;Directory Id="fr" Name="fr"/&gt;

          &lt;Component Id="RemoveAll" Guid="{63F6943C-7707-41CA-BAB9-7438471EC81E}"&gt;
            &lt;RemoveFile Id="RemoveAllFilesOnUninstall" Directory="INSTALLFOLDER" Name ="*.*" On ="uninstall"/&gt;
            &lt;RemoveFolder Id="RemoveAllFoldersOnUninstall" Directory="INSTALLFOLDER" On="uninstall"/&gt;
            &lt;RegistryValue Root="HKLM" Key="Software\Microsoft\MyApplication" Name="Path" Type="string" Value="[INSTALLFOLDER]" KeyPath="yes" /&gt;
            &lt;util:RemoveFolderEx On="uninstall" Property="INSTALLFOLDER" /&gt;
          &lt;/Component&gt;
        &lt;/Directory&gt;
      &lt;/Directory&gt;
    &lt;/Directory&gt;
  &lt;/Fragment&gt;

  &lt;Fragment&gt;
    &lt;DirectoryRef Id="ApplicationProgramsFolder"&gt;
      &lt;Component Id="ApplicationShortcut" Guid="{3B0B5064-807C-4E29-A701-E77BE8B8FA86}"&gt;
        &lt;Shortcut Id="ApplicationStartMenuShortcut"
                  Name="My Application"
                  Target="[#MyApplication.exe]"
                  WorkingDirectory="INSTALLFOLDER"/&gt;
        &lt;RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/&gt;
        &lt;RegistryValue Root="HKCU" Key="Software\Microsoft\MyApplication" Name="installed" Type="integer" Value="1" KeyPath="yes"/&gt;
      &lt;/Component&gt;
    &lt;/DirectoryRef&gt;
    &lt;DirectoryRef Id="DesktopFolder"&gt;
      &lt;Component Id="ApplicationShortcutDesk" Guid="{61087C99-9CA8-4191-8251-219DFDAFC666}"&gt;
        &lt;Shortcut Id="ApplicationStartDeskShortcut"
                  Name="My Application"
                  Target="[#MyApplication.exe]"
                  WorkingDirectory="INSTALLFOLDER"/&gt;
        &lt;RemoveFolder Id="DesktopFolder" On="uninstall"/&gt;
        &lt;RegistryValue Root="HKCU" Key="Software\Microsoft\MyApplication" Name="installed" Type="integer" Value="1" KeyPath="yes"/&gt;
      &lt;/Component&gt;
    &lt;/DirectoryRef&gt;
  &lt;/Fragment&gt;

  &lt;Fragment&gt;
    &lt;ComponentGroup Id="ProductComponents"&gt;
      &lt;Component Id="ProductComponent" Guid="{5C62E31A-C787-4B45-A4F7-2324A12C72D1}" Directory="INSTALLFOLDER"&gt;
        &lt;!-- List of DLL/EXE --&gt;
    &lt;/ComponentGroup&gt;
  &lt;/Fragment&gt;
&lt;/Wix&gt;
</code></pre>

<p><strong>Edit</strong>: I'm now using <code>UtilExtension</code> and the <code>INSTALLFOLDER</code> is now correctly deleted. The only elements renaming are the <code>ApplicationShortcutDesk</code> and the <code>ApplicationStartMenuShortcut</code>. How the <code>RemoveFolder</code>works for a shortcut ?</p>