Wix uninstall does not remove files

Viewed 2481

I have a C# project with a WiX installer.

When I install my application, all is working. I Have :

  • my compagny folder in program files (x86), containing my application folder and the drivers folder.
  • the shortcut in desktop
  • the shortcut in start menu

When application is installed, I can run my msi and I have an option to uninstall. But when I uninstall my application, only the drivers folder is removed (MyApplication_Drivers). I still have my application folder and the shortcuts.

What I'm missing ?

There is my code for product.wxs (entire code cause I don't know where the problem come from):

<?xml version="1.0" encoding="UTF-8"?>
<?define compagny = "My compagny"?>
<?define product = "MyApplication"?>
<?define version = "!(bind.FileVersion.MyApplication.exe)"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*"
           Name="$(var.product)"
           Language="1033"
           Version="$(var.version)"
           Manufacturer="$(var.compagny)"
           UpgradeCode="***">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <Media Id="1" Cabinet="MyApplication.cab" EmbedCab="yes"/>

    <Feature Id="ProductFeature" Title="$(var.product)" Level="1">
      <ComponentGroupRef Id="ProductComponents"/>
      <ComponentRef Id ="InstallFonts" />
      <ComponentRef Id ="ApplicationShortcut"/>
      <ComponentRef Id ="ApplicationShortcutDesk"/>
    </Feature>

    <Property Id="WIXUI_INSTALLDIR" Value="COMPAGNYFOLDER"/>    

    <WixVariable Id="WixUIBannerBmp"
                 Value=".\Images\WixUIBannerBmp.bmp"/>
    <WixVariable Id="WixUIDialogBmp"
                 Value=".\Images\WixUIDialogBmp.bmp"/>

    <UI>
      <UIRef Id="WixUI_Custom"/>      

      <Publish Dialog="WelcomeDlg"
               Control="Next"
               Event="NewDialog"
               Value="InstallDirDlg"
               Order="2">1</Publish>

      <Publish Dialog="InstallDirDlg"
               Control="Back"
               Event="NewDialog"
               Value="WelcomeDlg"
               Order="2">1</Publish>
    </UI>
    </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="FontsFolder" />

      <Directory Id="ProgramMenuFolder">
        <Directory Id="ApplicationProgramsFolder" Name="$(var.compagny)"/>
      </Directory>

      <Directory Id="DesktopFolder" SourceName="Desktop"/>

      <Directory Id="ProgramFilesFolder">
        <Directory Id="COMPAGNYFOLDER" Name="$(var.compagny)">
          <Directory Id="INSTALLFOLDER" Name="$(var.product)">
            <Directory Id="fr" Name="fr"/>
            <Directory Id="SETTINGS" Name="Settings">
              <Directory Id="PRINTERS" Name="Printers"/>
            </Directory>
          </Directory>
          <Directory Id="Drivers" Name="MyApplication_Drivers"/>
        </Directory>
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <DirectoryRef Id="ApplicationProgramsFolder">
      <Component Id="ApplicationShortcut" Guid="***">
        <Shortcut Id="ApplicationStartMenuShortcut"
                  Name="$(var.product)"
                  Description="$(var.product) application"
                  Target="[#MyApplication.exe]"
                  WorkingDirectory="INSTALLFOLDER"/>
        <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="SOFTWARE\$(var.compagny)\$(var.product)" Name="installedStart" Type="integer" Value="1" KeyPath="yes"/>
      </Component>
    </DirectoryRef>

    <DirectoryRef Id="DesktopFolder">
      <Component Id="ApplicationShortcutDesk" Guid="***">
        <Shortcut Id="ApplicationStartDeskShortcut"
                  Name="$(var.product)"
                  Description="$(var.product) application"
                  Target="[#MyApplication.exe]"
                  WorkingDirectory="INSTALLFOLDER"/>
        <RemoveFolder Id="DesktopFolder" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="SOFTWARE\$(var.compagny)\$(var.product)" Name="installedDesk" Type="integer" Value="1" KeyPath="yes"/>
      </Component>
    </DirectoryRef>

    <DirectoryRef Id="FontsFolder">
      <Component Id="InstallFonts" Guid="{***}" Permanent="yes">
        <File Id="OCRB_Medium.ttf" Source="$(var.SolutionDir)_Required\OCRB_Medium.ttf" TrueType="yes" />
        <File Id="OCRBS___.TTF" Source="$(var.SolutionDir)_Required\OCRBS___.TTF" TrueType="yes" />
      </Component>
    </DirectoryRef>
  </Fragment>

    <Fragment>
    <ComponentGroup Id="ProductComponents">
      <!-- Application -->
      <Component Id="ProductComponent" Guid="{***}" Directory="INSTALLFOLDER" UninstallWhenSuperseded="yes">
        <!-- DLL -->
        <File Id="Bitmap.Core.dll" Source="$(var._Delivery.TargetDir)..\bin\Bitmap.Core.dll"/>
        <File Id="PdfLib.dll" Source="$(var._Delivery.TargetDir)..\bin\PdfLib.dll"/>

        <!-- EXE -->
        <File Id="MyApplication.exe" Source="$(var._Delivery.TargetDir)..\bin\MyApplication.exe"/>
        <File Id="MyApplication.exe.config" Source="$(var._Delivery.TargetDir)..\bin\MyApplication.exe.config"/>
      </Component>

      <!-- fr -->
      <Component Id="FRComponent" Guid="{***}" Directory="fr" UninstallWhenSuperseded="yes">
        <File Id="resources-fr.dll" Source="$(var._Delivery.TargetDir)..\bin\fr\resources-fr.dll" />
      </Component>

      <!-- Settings -->
      <Component Id="SetComponent" Guid="{***}" Directory="SETTINGS" UninstallWhenSuperseded="yes">
        <File Id="Settings.xml" Source="$(var.MyApplication.ProjectDir)Settings\Settings.xml" />
      </Component>

      <!-- Printers -->
      <Component Id="PrintComponent" Guid="{***}" Directory="PRINTERS" UninstallWhenSuperseded="yes">
        <File Id="Sticker.xml" Source="$(var.MyApplication.ProjectDir)Settings\Printers\Sticker.xml" />
      </Component>

      <!-- Resources -->
      <Component Id="Drivers" Guid="{***}" Directory="Drivers" UninstallWhenSuperseded="yes">
        <File Id="drivers.exe" Source="$(var.SolutionDir)_Required\drivers.exe"/>
        <File Id="user_manual_E.pdf" Source="$(var.SolutionDir)_Required\user_manual_E.pdf"/>
      </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

EDIT :

  • An old version of this code was perfectly working

  • I printed log while uninstall and this line seems to be related to this problem :

MSI (c) (E8:BC) [10:58:16:769]: Disallowing uninstallation of component: {one of my guids} since another client exists

2 Answers
Related