Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wix在卸载时不删除文件_Wix_Windows Installer_Wix3.5 - Fatal编程技术网

Wix在卸载时不删除文件

Wix在卸载时不删除文件,wix,windows-installer,wix3.5,Wix,Windows Installer,Wix3.5,我看到了其他人在这件事上的问题,但我不能让它为我工作。我正在尝试适应Wix,以便我们可以迁移我们的vdproj(我觉得我们在这里向前走了1步,向后走了4步……Wix最基本的东西已经变得完全不平凡了……但我确实看到了为建筑安装人员提供完全成熟的声明性标记的价值) 我在SharpDevelop的wixproj中有以下WX 安装工程。卸载不执行任何操作,并保留安装文件夹和dll。有什么问题吗 Files.wxs: <?xml version="1.0"?> <Wix xmlns="h

我看到了其他人在这件事上的问题,但我不能让它为我工作。我正在尝试适应Wix,以便我们可以迁移我们的vdproj(我觉得我们在这里向前走了1步,向后走了4步……Wix最基本的东西已经变得完全不平凡了……但我确实看到了为建筑安装人员提供完全成熟的声明性标记的价值)

我在SharpDevelop的wixproj中有以下WX

安装工程。卸载不执行任何操作,并保留安装文件夹和dll。有什么问题吗

Files.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>

Setup.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>

INSTALLDIR
1.
"1"]]>
1.
未安装
安装并修补
1.
1.
不是WIXUI_DONTVALIDATEPATH
"1"]]>
WIXUI\u DONTVALIDATEPATH或WIXUI\u INSTALLDIR\u VALID=“1”
1.
1.
未安装
已安装但未安装修补程序
安装并修补
1.
1.
1.
1.

尝试更改未卸载组件的GUID。我也试过同样的方法,它对我有效。这可能是因为GUID已由其他产品在注册表中注册

原因通常是注册表中的组件引用计数混乱-通常发生在开发过程中的开发框上。由于Installshield软件包使用了(遗留的、非MSI引用计数),这也经常发生在Installshield软件包上

一些技术细节: 在干净的虚拟机上进行测试,以验证问题是真实的,而不是开发盒问题。更改组件GUID可能会产生影响(修补问题等)


我不知何故使我的项目处于无法卸载我的每一个组件的状态。我不知道怎么做。我编写了一个程序,它将接受一个.wixproj文件,并将所有组件guid更改为新的guid,从而解决了这个问题(在我手动删除这些文件之后)。这是基于用户593287的答案

参数应该是项目文件的路径。从命令行运行此命令的示例如下:

GuidFixer.exe MyProject.csproj

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);
                }
            }
        }        
    }
}
使用系统;
使用System.Collections.Generic;
使用System.IO;
使用System.Xml;
命名空间GuidFixer
{
公共课程
{
公共静态void Main(字符串[]args)
{
字符串projectFileName=args[0];
字符串路径=path.GetDirectoryName(项目文件名);
列表文件=新列表();
XmlDocument projectDocument=新的XmlDocument();
projectDocument.Load(projectFileName);
XmlNamespaceManager=newxmlnamespacemanager(projectDocument.NameTable);
manager.AddNamespace(“msbld”http://schemas.microsoft.com/developer/msbuild/2003");
//查找项目中包含的所有文件。
XmlNodeList nodes=projectDocument.SelectNodes(“/msbld:Project/msbld:ItemGroup/msbld:Compile”,管理器);
foreach(节点中的XmlNode节点)
{
字符串文件名=Path.Combine(路径,节点.Attributes[“Include”].Value);
添加(文件名);
}
foreach(文件中的字符串文件名)
{
//让我们只做.wxs文件
如果(!Path.GetExtension(fileName).Equals(“.wxs”,StringComparison.CurrentCulture))
{
继续;
}
//这将只更新非只读的文件,请确保
//在运行之前,请从源代码管理中签出文件。
FileAttributes=File.GetAttributes(文件名);
if((attributes&FileAttributes.ReadOnly)=FileAttributes.ReadOnly)
{
继续;
}
bool-modified=false;
XmlDocument doc=新的XmlDocument();
doc.PreserveWhitespace=true;//标记内的空间仍然丢失
doc.Load(文件名);
foreach(doc.GetElementsByTagName(“组件”)中的XmlNode节点)
{
Guid=Guid.NewGuid();
字符串值=guid.ToString(“B”).ToUpper();
node.Attributes[“Guid”]。Value=Value;
修改=真;
}
//仅更新已修改的文件,以保留格式。
如果(修改)
{
文件保存(文件名);
}
}
}        
}
}

我在没有测试的情况下对它做了一些更改,所以祝你好运,这很简单。

我遇到了一个类似的问题,当我将所有guid转换为大写时,似乎不再出现这个问题(如某些兼容性问题规范所要求的那样)。没有严格测试这是否真的是问题的解决方案。也许这与前面的答案相同。

值得检查以下注册表项以查看是否列出了您的文件。这可能会导致卸载程序忽略组件,因为它认为这些组件是共享的

HKLM\Software\Microsoft\Windows\CurrentVersion\SharedDlls

确保没有其他MSI软件包在安装您的组件

具体来说,进入控制面板/程序和功能,然后