0

I have a project which uses wix to generate an install package. The install works fine, but when one tries to uninstall the project, everything looks nice - but after the unistall finishes the product ist still there (still functioning). The entry in add/remove programs disappears when uninstalled from there, but comes back after a refresh (F5). Testers have found that everything looks like the uninstall actually does a repair.

What are we doing wrong (the project otherwise only generates further component fragment files with "heat" (with HeatDirectory-Entries in the wixproj), and defines a few preprocessor variables)?

Here's the product.wxs. Sorry, I know thats a lot of code, but I do not know what I can safely omit to find the problem...:

<?xml version="1.0" encoding="UTF-8"?>
<?define ProductVersion=1.1.0.0?>
<?define UpgradeCode=$(var.UpdateCode)?>
<?define ProductName=$(var.PV) Name?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="xyz" UpgradeCode="$(var.UpgradeCode)">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" />

    <SetProperty Id="REINSTALL" Value="ALL" After="FindRelatedProducts" >Installed AND Remove&lt;&gt;"ALL"</SetProperty>
    <SetProperty Id="REINSTALLMODE" Value="vamus" After="FindRelatedProducts">Installed AND Remove&lt;&gt;"ALL"</SetProperty>

    <MajorUpgrade DowngradeErrorMessage="A newer version of $(var.ProductName) is already installed." />
    <MediaTemplate EmbedCab="yes" />

    <Feature Id="ProductFeature" Title="XY Installer" Level="1" ConfigurableDirectory="INSTALLLOCATION">
            <ComponentGroupRef Id="ProductComponents" />
      <ComponentGroupRef Id="DesktopShortcutComponentGroup"/>
      <ComponentGroupRef Id="StartmenuShortcuts"/>
        </Feature>

    <CustomAction Id="RestoreDatabase" Directory="INSTALLLOCATION" ExeCommand="[INSTALLLOCATION]initial_db\BURestore.exe $(var.Sport)_$(var.Project) D:\$(var.Sport)\initial_db\db.bak" Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" />
    <CustomAction Id="RenameFormatFilesFolder" Directory="LISTTOOLLOCATION" ExeCommand="cmd /c &quot;mv FormatFiles fmt&quot;" Return="ignore" Impersonate="yes"></CustomAction>
    <InstallExecuteSequence>
      <Custom Action="RestoreDatabase" Before="InstallFinalize">NOT REMOVE</Custom>
      <Custom Action="RenameFormatFilesFolder" After="InstallFinalize">NOT REMOVE</Custom>
    </InstallExecuteSequence>
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION"/>
    <UI>
      <UIRef Id="WixUI_InstallDir"/>
      <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="ROOTDIR" Name="D"/>
      <Directory Id="INSTALLLOCATION" Name="$(var.PV)">
        <Directory Id="CONF" Name="conf">
          <Directory Id="LISTTOOLLOCATION" Name="PRINT"></Directory>
        </Directory>
      </Directory>
      <Directory Id="DesktopFolder" />
      <Directory Id="ProgramMenuFolder">
        <Directory Id="ProgramMenuSubfolder" Name="ST">
          <Directory Id="ApplicationFolder" Name="$(var.ProductName)" />
        </Directory>
      </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLLOCATION">
        <ComponentGroupRef Id="RootFiles" />
        <ComponentGroupRef Id="ListToolFiles" />
        <ComponentGroupRef Id="inis" />
        </ComponentGroup>
    <ComponentGroup Id="DesktopShortcutComponentGroup">
      <Component Id="DesktopShortcutComponent" Guid="{C54B....}" Directory="DesktopFolder">
        <Shortcut Id="ApplicationDesktopShortcut"
           Name="$(var.ProductName)"
           Description="$(var.ProductName) Application"
           Target="[INSTALLLOCATION]RO.exe"
           WorkingDirectory="INSTALLLOCATION"/>
        <RemoveFolder Id="DesktopFolder" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="Software\ST\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
      </Component>
    </ComponentGroup>
    <ComponentGroup Id="StartmenuShortcuts" Directory="ApplicationFolder">
      <Component Id="StartmenuShortcutComp" Guid="{ACD9...}">
        <Shortcut Id="StartmenuShortcut" Name="$(var.ProductName)" Description="$(var.ProductName) Application" Target="[INSTALLLOCATION]RO.exe" WorkingDirectory="INSTALLLOCATION" />
        <Shortcut Id="UninstallProduct"  Name="Uninstall $(var.ProductName)" Target="[SystemFolder]msiexec.exe" Arguments="/x [ProductCode]" Description="Uninstalls $(var.ProductName)" />
        <RemoveFolder Id="RemoveProgramMenuSubfolder" Directory="ProgramMenuSubfolder" On="uninstall"/>
        <RemoveFolder Id="RemoveApplicationFolder" Directory="ApplicationFolder" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="Software\ST\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
      </Component>
    </ComponentGroup>
    </Fragment>
</Wix>
FrankB
  • 349
  • 4
  • 10

1 Answers1

1

The below two lines are making this issue.

<SetProperty Id="REINSTALL" Value="ALL" After="FindRelatedProducts" >Installed AND Remove&lt;&gt;"ALL"</SetProperty>
<SetProperty Id="REINSTALLMODE" Value="vamus" After="FindRelatedProducts">Installed AND Remove&lt;&gt;"ALL"</SetProperty>

That condition become true because Remove will be set ALL in Uninstall after InstallValidate action in Install execute sequence. Please check below link for more details.

https://msdn.microsoft.com/en-us/library/aa368013(v=vs.85).aspx

Vinoth
  • 1,975
  • 21
  • 34
  • Does not make entire sense to me why the installer kind of does not know that it is an uninstall at that moment - but if it is like this; it is like this... Our solution now is this: http://stackoverflow.com/questions/114165/how-to-implement-wix-installer-upgrade/114736#114736 – FrankB Apr 16 '15 at 12:13