Wix No elimina archivos al desinstalar


He visto las preguntas de otros sobre este asunto, pero no puedo hacer que funcione para mí. Estoy tratando de acostumbrarme a Wix para que podamos migrar nuestros vdproj (siento que hemos dado 1 paso adelante y 4 pasos atrás aquí...las cosas más básicas se han vuelto completamente no triviales con Wix...pero sí veo valor en tener un marcado declarativo completo para los instaladores de edificios).

Tengo los siguientes wxs en un wixproj en SharpDevelop.

La instalación funciona. Desinstalar no hace nada y se va la carpeta de instalación y dll en su lugar. ¿Cuál es el problema?

Archivos.wxs:

<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="TARGETDIR">
            <Directory Id="ProgramFilesFolder" Name="PFiles">
                <Directory Id="INSTALLDIR" Name="Client">
                    <Component Id="InteropDll" Guid="AD09F8B9-80A0-46E6-9E36-9618E2023D66" DiskId="1">
                        <File Id="Interop.dll" Name="Interop.dll" Source="..\Interop\bin\$(var.Configuration)\Interop.dll" KeyPath="yes" />
                        <RemoveFile Id="RemoveInterop.dll" Name="Interop.dll" On="uninstall" />
                    </Component>
                </Directory>
            </Directory>
        </DirectoryRef>
    </Fragment>
</Wix>

Configuración.wxs:

<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*"
        Name="Client Setup"
        Language="1033"
        Version="1.0.0.0"
        UpgradeCode="4A88A3AD-7CB6-46FB-B2FD-F4EADE0218F8"
        Manufacturer="Client Setup">
        <Package Description="#Description"
            Comments="Comments"
            InstallerVersion="200"
            Compressed="yes"/>
        <!--
            Source media for the installation. 
            Specifies a single cab file to be embedded in the installer's .msi. 
        -->
        <Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/>

        <!-- Installation directory and files are defined in Files.wxs -->
        <Directory Id="TARGETDIR" Name="SourceDir"/>

        <Feature Id="Complete"
                 Title="Client Setup"
                 Description="Client Setup"
                 Level="1">
            <ComponentRef Id="InteropDll" />
        </Feature>

        <!-- 
            Using the Wix UI library

            WixUI_InstallDir does not allow the user to choose 
            features but adds a dialog to let the user choose a 
            directory where the product will be installed
        -->
        <Property Id="WIXUI_INSTALLDIR">INSTALLDIR</Property>

        <UI Id="WixUI_InstallDir">
            <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
            <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
            <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />

            <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
            <Property Id="WixUI_Mode" Value="InstallDir" />

            <DialogRef Id="BrowseDlg" />
            <DialogRef Id="DiskCostDlg" />
            <DialogRef Id="ErrorDlg" />
            <DialogRef Id="FatalError" />
            <DialogRef Id="FilesInUse" />
            <DialogRef Id="MsiRMFilesInUse" />
            <DialogRef Id="PrepareDlg" />
            <DialogRef Id="ProgressDlg" />
            <DialogRef Id="ResumeDlg" />
            <DialogRef Id="UserExit" />

            <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
            <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>

            <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>

            <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">NOT Installed</Publish>
            <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>

            <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
            <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
            <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
            <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
            <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
            <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
            <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>

            <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1">NOT Installed</Publish>
            <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
            <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>

            <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>

            <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
            <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
            <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>

            <Property Id="ARPNOMODIFY" Value="1" />
        </UI>

        <UIRef Id="WixUI_Common" />
    </Product>
</Wix>
Author: Jeff, 2011-09-23

5 answers

Intente cambiar el GUID de los componentes que no se están desinstalando. Intenté lo mismo y funcionó para mí. Puede ser porque el GUID ya está registrado en el registro por algún otro producto.

 39
Author: Jony Lalwani,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-09-12 12:42:41

Asegúrese de que ningún otro paquete MSI mantiene sus componentes instalados.

Específicamente, vaya al Panel de Control / Programas y Características, y asegúrese de que no haya una versión "antigua" de su programa todavía instalada.

 6
Author: Dave Mackersie,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-12-22 18:21:37

De alguna manera tengo mi proyecto en el estado donde cada uno de mis componentes no se podía desinstalar. No tengo idea de cómo. Escribí un programa que tomará una .wixproj archivo y cambiar todos los componentes GUID a nuevos GUID y que resolvió el problema (después de eliminar manualmente los archivos). Esto se basa en la respuesta de user593287.

using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;

namespace GuidFixer
{
    public class Program
    {
        public static void Main(string[] args)
        {
            string projectFileName = args[0];
            string path = Path.GetDirectoryName(projectFileName);
            List<string> files = new List<string>();

            XmlDocument projectDocument = new XmlDocument();            
            projectDocument.Load(projectFileName);
            XmlNamespaceManager manager = new XmlNamespaceManager(projectDocument.NameTable);
            manager.AddNamespace("msbld", "http://schemas.microsoft.com/developer/msbuild/2003");

            // Finds all of the files included in the project.
            XmlNodeList nodes = projectDocument.SelectNodes("/msbld:Project/msbld:ItemGroup/msbld:Compile", manager);
            foreach (XmlNode node in nodes)
            {
                string fileName = Path.Combine(path, node.Attributes["Include"].Value);
                files.Add(fileName);
            }

            foreach (string fileName in files)
            {
                // Lets only do .wxs files
                if (!Path.GetExtension(fileName).Equals(".wxs", StringComparison.CurrentCulture))
                {
                    continue;
                }

                // This will only update files that aren't readonly, make sure
                // you check out your files from source control before running.
                FileAttributes attributes = File.GetAttributes(fileName);
                if ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
                {
                    continue;
                }

                bool modified = false;

                XmlDocument doc = new XmlDocument();
                doc.PreserveWhitespace = true; // space inside tags are still lost
                doc.Load(fileName);

                foreach (XmlNode node in doc.GetElementsByTagName("Component"))
                {
                    Guid guid = Guid.NewGuid();
                    string value = guid.ToString("B").ToUpper();

                    node.Attributes["Guid"].Value = value;
                    modified = true;
                }

                // Only update files that were modified, to preserve formatting.
                if (modified)
                {
                    doc.Save(fileName);
                }
            }
        }        
    }
}

Hice algunos cambios sin probarlo, así que buena suerte, aunque es bastante sencillo.

 5
Author: Joel McBeth,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-12-21 15:32:41

Valdría la pena revisar la siguiente clave de registro para ver si sus archivos están listados. Esto puede hacer que el desinstalador ignore los componentes, ya que cree que se comparten.

HKLM\Software\Microsoft\Windows\CurrentVersion\SharedDlls
 3
Author: Armin Sadeghi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-04 06:21:27

Me encontré con un problema similar, que parece que ya no está presente cuando convertí todos los guid en mayúsculas (como se requiere en algunas especificaciones para problemas de compatibilidad). No probó exensivamente si esta era realmente la solución al problema. Tal vez esto es lo mismo que la respuesta anterior.

 1
Author: user3199331,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-01-15 17:37:19