Wix uninstall not removing files, always assumes program filesmyApp folder

Questions


I’m having a problem with the Wix installer and don’t know what specifically I’m missing.
I have enabled the dialog to allow user pick their own installation folder over the default of

If I run the install and just leave the default of “Program FilesMyApp”, the app installs no problem. If I then uninstall, all the files and folders properly get deleted.

If I run the install and change the default to something like c:TestFolderMyApp, it installs no problem to that location and includes the subfolder for the Java64bit and Java64bit/lib folders with respective content.

Then, if I immediately do an uninstall, it properly removes the Java stuff completely, but leaves all the files within the c:TestFolderMyApp root.

Looking into the registry after install, it DOES show the proper install directory location. What else can I provide to help resolve this.

Here is the full (with GUIDs removed) install of different files

File for the main (sample) product

<?xml version="1.0" encoding="utf-32BE"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product
        Name="AMyApp"
        Manufacturer="Testing"
        Language="1033"
        Version="1.0.1.0"
        Id="*"
        UpgradeCode="{GUID1}" >

        <?include AMyApp_Define_Paths.wxi ?>

        <Package 
            Id="*"
            InstallerVersion="200"
            Platform="x64"
            Compressed="yes"
            Languages="1033"
            SummaryCodepage="1252"
            Comments="AMyApp Package Comments area"
            Description ="AMyApp"
            InstallScope="perMachine" />

        <MajorUpgrade 
            AllowDowngrades="no"
            AllowSameVersionUpgrades="yes"
            DowngradeErrorMessage="A newer version of AMyApp is already installed." />

        <Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />

        <Upgrade Id="{GUID1}">
            <UpgradeVersion
               Minimum="4.0.0.0" Maximum="99.0.0.0"
               Property="PREVIOUSVERSIONSINSTALLED"
               IncludeMinimum="yes" IncludeMaximum="no" />
        </Upgrade>

        <Media Id="1" 
            Cabinet="AMyApp.cab" 
            EmbedCab="yes" />

        <WixVariable Id="ALLUSERS" Value="2" />
        <WixVariable Id="MSIINSTALLPERUSER" Value="" />

        <!-- see if location from a previously installed instance. -->
        <Property Id="INSTALLDIR" >
            <RegistrySearch Id="AMYAPP" Type="raw"
              Root="HKLM" Key="SOFTWAREAMYAPP" Name="InstallDir" />
        </Property>
        <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />

        <!-- Search registry for previous installed location -->
        <Property Id="PREVIOUSINSTALLFOLDER">
            <RegistrySearch Id="GetPreviousInstallFolder" Root="HKLM"
               Key="SOFTWAREAMYAPP" Name="INSTALLDIR" Type="raw" />
        </Property>

        <CustomAction Id="SetINSTALLDIR"  Property="INSTALLDIR" 
            Value="[PREVIOUSINSTALLFOLDER]" Execute="firstSequence" />
        <CustomAction Id="SetWIXUI_INSTALLDIR"  Property="WIXUI_INSTALLDIR" 
            Value="[PREVIOUSINSTALLFOLDER]" Execute="firstSequence" />
        <InstallExecuteSequence>
            <Custom Action="SetINSTALLDIR"
               After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
            <Custom Action="SetWIXUI_INSTALLDIR" 
               After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
        </InstallExecuteSequence>
        <InstallUISequence>
            <Custom Action="SetINSTALLDIR" 
               After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
            <Custom Action="SetWIXUI_INSTALLDIR" 
               After="AppSearch">PREVIOUSINSTALLFOLDER</Custom>
        </InstallUISequence>

        <Directory Id="TARGETDIR" Name="SourceDir" >
            <!-- The directories "DesktopFolder", "FontsFolder", "ProgramFilesFolder" 
              are all pre-defined common names via the installer and reference the 
              actual windows locations respectively -->
            <Directory Id="DesktopFolder" />
            <Directory Id="FontsFolder" />
            <Directory Id="ProgramFiles64Folder" >
                <!-- The "ID" is the name internally that refers to the folder when
                  trying to install files, etc... the "Name" is what the actual name 
                  will be at actual install time as viewed by Windows Explorer -->
                <Directory Id="INSTALLDIR" Name="AMYAPP" >
                    <Component Id="C_HKLM_AMyAppUsage" Guid="{GUID2}">
                        <RegistryKey Root="HKLM" Key="SOFTWAREAMyApp" >
                            <RegistryValue Name="IsSomeKey" Type="string" Value="YES" KeyPath="yes" />
                        </RegistryKey>
                    </Component>
                    <Directory Id="Java64BitDIR" Name="Java64Bit" >
                        <Directory Id="Java64BitLibDIR" Name="Lib" />
                    </Directory>
                </Directory>
            </Directory>
        </Directory>

        <Feature Id="AMyApp_Features"
            Title="AMyApp (Wix Testing)"
            Level="1"
            ConfigurableDirectory="INSTALLDIR" >

            <ComponentRef Id="C_HKLM_AMyAppUsage" />

            <ComponentRef Id="AMyApp_CORE" />
            <ComponentRef Id="AMyApp_Shortcuts" />
            <ComponentRef Id="JAVA64BIT_Support" />
            <ComponentRef Id="JAVA64BITLIB_Support" />
        </Feature>

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

            <!-- Skip license dialog -->
            <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>

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

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

        <Property Id="LAUNCHAPPONEXIT" Value="1" />
    </Product>
</Wix>

Fragment file for the Java Subfolders sample

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <?include AMyApp_Define_Paths.wxi ?>
        <DirectoryRef Id="Java64BitDIR">
            <Component Id="JAVA64BIT_Support" Guid="{GUID1a}">
                <File Id="_64_javax.comm.properties" Source="$(var.Path_Java64Bit)javax.comm.properties" />
            </Component>
        </DirectoryRef>
        <DirectoryRef Id="Java64BitLibDIR">
            <Component Id="JAVA64BITLIB_Support" Guid="{GUID2a}">
                <File Id="_64_HardwireDriver.jar" Source="$(var.Path_Java64BitLib)HardwireDriver.jar" />
            </Component>
        </DirectoryRef>
    </Fragment>
</Wix>

Fragment file for the common stuff installed at root folder

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" >
    <Fragment>
        <DirectoryRef Id="INSTALLDIR">
            <Component Id="AMyApp_CORE" Guid="{GUID1c}" Win64="yes">
                <?include AMyApp_Define_Paths.wxi ?>

                <RegistryKey 
                    Root="HKLM" 
                    Key="SOFTWAREAMyApp" 
                    ForceCreateOnInstall="yes" 
                    ForceDeleteOnUninstall="yes" >

                    <RegistryValue Type="string" Name="InstallDir" Value="[INSTALLDIR]"/>
                    <RegistryValue Type="string" Name="MyAppContext" Value="Testing"/>
                </RegistryKey>

                <RemoveFile Id="RemoveAllMyAppFiles" Name="*.*" On="uninstall" />
                <RemoveFolder Id="INSTALLDIR" On="uninstall" />

                <File Id="MyApp.exe" Source="$(var.Path_MyAppReleaseFolder)MyApp.exe" />
            </Component>
        </DirectoryRef>
    </Fragment>
</Wix>

 

 

————————————————-

Answer

Here is a simplified work-around I came up with, but don’t know why it does what it does under the hood, but works.

During the declaration of the <UI> segment, I just changed both “Welcome” and “MaintenanceWelcome” dialogs to both go to the “Install Directory” dialog. It apparently bypasses the route for “Repair” / “Uninstall” but WILL allow the installer to handle it’s own delete of original and re-publish the new files from the installer.

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

    <!--<Property Id="WixUI_Mode" Value="InstallDir" />-->

    <!-- Skip license dialog -->
    <Publish Dialog="WelcomeDlg"
             Control="Next"
             Event="NewDialog"
             Value="InstallDirDlg"
             Order="2">1</Publish>

    <!-- Send the MAINTENANCE Dialog to the same Install Dir dialog -->
    <Publish Dialog="MaintenanceWelcomeDlg"
             Control="Next"
             Event="NewDialog"
             Value="InstallDirDlg"
             Order="2">1</Publish>

   ...
</UI>

installer,uninstall,windows-installer,wix

Facebook Comments

Website Comments

  1. http://www.linux.co.uk
    Reply

    Propeгlү, Im stunned you all left the ѵery extra finest one foг me.?
    Ɗadɗy mentioned with a teaѕing smile. ?It?s that he despatched Jesսs to die for
    us and gіve us life without end and ever annd that because oof that weе
    will be a family іn heɑvеn for tens of millions of years.
    That?s fairly gopd isnt it?

Post a comment