Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.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_Installation_Windows Installer_Major Upgrade - Fatal编程技术网

wix生成的更新旧版本的安装程序不';不要删除文件夹

wix生成的更新旧版本的安装程序不';不要删除文件夹,wix,installation,windows-installer,major-upgrade,Wix,Installation,Windows Installer,Major Upgrade,我有2个msi安装程序由WiX生成。第一个(安装程序1)的版本为=“1.0.0.0”,而第二个(安装程序2)的版本为=“1.1.0.0”。它们都有ProductCode=“*”和UpgradeCode=“UpgradeCode” 安装程序1在%AppData%\MyApp\1.0.0.0文件夹中安装一个exe文件,并在SOFTWARE\MyApp\1.0.0.0下的注册表中写入一个条目。该条目的值为1.0.0.0 安装程序2的预期行为是,在其安装过程中,将从控制面板中取消安装以前的版本(1.0.

我有2个msi安装程序由WiX生成。第一个(安装程序1)的版本为=“1.0.0.0”,而第二个(安装程序2)的版本为=“1.1.0.0”。它们都有ProductCode=“*”和UpgradeCode=“UpgradeCode”

安装程序1在%AppData%\MyApp\1.0.0.0文件夹中安装一个exe文件,并在SOFTWARE\MyApp\1.0.0.0下的注册表中写入一个条目。该条目的值为1.0.0.0

安装程序2的预期行为是,在其安装过程中,将从控制面板中取消安装以前的版本(1.0.0.0),其条目将从注册表中删除,文件夹将从%AppData%\MyApp中取消安装

实际情况是,1.0.0.0版未从控制面板中安装,条目从注册表中删除,新版本的条目已安装,但文件夹%AppData%\MyApp\1.0.0.0仍保留在那里,并在%AppData%\MyApp下创建了一个新文件夹1.1.0.0

有谁能帮我找出我的代码有什么问题,以及如何解决

<Product    Id="*" 
            Name="MyApplication" 
            Language="1033" 
            Version="$(var.ProductVersion)" 
            Manufacturer="MyCompany" 
            UpgradeCode="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}">

    <Package    InstallerVersion="200"
                Compressed="yes" 
                Description="Installer for my application" 
                InstallScope="perUser"/>

    <Upgrade Id="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}">

        <UpgradeVersion     Minimum="$(var.ProductVersion)" 
                            OnlyDetect="yes" 
                            Property="NEWERVERSIONDETECTED"/>

        <UpgradeVersion     Property="OLDERVERSIONBEINGUPGRADED"
                            Minimum="1.0.0.0" 
                            IncludeMinimum="yes"
                            Maximum="$(var.ProductVersion)" 
                            IncludeMaximum="no"/>
    </Upgrade>

    <Property   Id="MSIRESTARTMANAGERCONTROL" 
                Value="Disable"/>

    <InstallExecuteSequence>

        <RemoveExistingProducts Before="InstallInitialize" />

    </InstallExecuteSequence> 

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

    <Directory  Id="TARGETDIR" 
                Name="SourceDir">

        <Directory  Id="AppDataFolder">

            <Directory      Id="CompanyDir" 
                            Name="MyApp">

                <Component      Id="CompanyDirComp" 
                                Guid="*">

                    <RemoveFolder   Id="RemCompanyDir" 
                                    On="uninstall"
                                    Property="CompanyDir"/>

                    <RegistryValue  Root="HKCU"
                                    Key="SOFTWARE\MyApp"
                                    Name="Uninstall"
                                    Type="string"
                                    Value="$(var.ProductVersion)"
                                    KeyPath="yes"/>

                    <RemoveRegistryKey  Action="removeOnInstall" 
                                        Id="cd"
                                        Key="SOFTWARE\MyApp"
                                        Root="HKCU"/>

                </Component>

                <Directory      Id="INSTALLDIR"
                                Name="$(var.ProductVersion)">

                    <Component  Id="CompanyDirInstallComp"
                                Guid="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}">

                        <RegistryValue  Root="HKCU"
                                        Key="SOFTWARE\MyApp\$(var.ProductVersion)"
                                        Name="Uninstall"
                                        Type="string"
                                        Value="$(var.ProductVersion)"
                                        KeyPath="yes"/>

                        <RemoveFolder   Id="RemINSTALLDIR" 
                                        On="uninstall"
                                        Property="INSTALLDIR"/>             

                        <File Id="myFile.exe" Source="C:\Users\myFile.exe"/>

                        <RemoveFile     Id="RemMyFile" 
                                        On="uninstall"
                                        Name="*.exe"/>              


                    </Component>

                </Directory>

            </Directory>

        </Directory>

    </Directory>

</Product>


更新问题:

我已经在Windows8.1x32和Windows8.1x64上测试了上述代码。安装程序2在Windows 8.1x64上正常工作;在安装过程中,以前的版本(1.0.0.0)未从控制面板中安装,其条目从注册表中删除,文件夹未从%AppData%\MyApp中安装。在Windows 8.1x32 installer 2上,仅Unistall控制面板上的早期版本,但其条目仍保留在注册表中,并且不会删除文件夹

我使用cmd和以下命令运行安装程序2: msiexec/i installer2.msi/l*v log.txt

Windows 8.1x64输出: 动作2:45:13:查找最新的产品。搜索相关应用程序 操作开始时间2:45:13:查找最新的产品。 FindRelatedProducts:找到的应用程序:{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXX} MSI(c)(48:7C)[02:45:13:828]:属性更改:添加旧的\u版本\u检测到的属性。其值为“{XXXXXXXX-XXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}”。 行动于2:45:13结束:FindRelatedProducts。返回值1

Windows 8.1x32输出: MSI(c)(68:20)[01:45:29:831]:执行操作:FindRelatedProducts MSI(c)(68:20)[01:45:29:831]:注:1:22052:3:ActionText 动作1:45:29:查找最新的产品。搜索相关应用程序 操作开始1:45:29:查找最新的产品。 行动于1:45:29结束:FindRelatedProducts。返回值1

由于某些原因,在Windows 8.1x32安装程序2上找不到版本1.0.0.0
有什么想法会导致上述问题吗?

我会获取详细的升级日志以寻找线索。想法:如果exe已经用完了那个文件夹,那么时间可能不允许删除它,这样在重新启动后额外的文件夹就会消失。可能值得检查一下,这些组件的组件GUID在MSI之间是否不同,这样实际上就可以删除资源了。执行升级时.exe未运行,并且重新启动后文件夹不会消失。将组件guid替换为*但在编译时,我得到:错误CNDL0230:component/@guid属性的值“*”对此组件无效,因为它不符合自动生成guid的条件。具有注册表键路径和文件的组件不能使用自动生成的guid。创建多个组件,每个组件具有一个文件和/或一个注册表值keypath,以使用自动生成的guid。