Doc*_*own 8 windows installer windows-installer wix
我们有一个使用Wix创建的产品安装程序,其中包含程序包(" V1 ")和一些配置文件.现在,我们将使用新的产品代码进行重大升级,其中卸载了旧版本的产品并安装了" V2 ".我们想要的是保存其中一个配置文件免于卸载,因为它也需要V2.不幸的是,我们Permanent="yes"在发送V1时忘记设置选项(阅读此问题以获取更多信息).
这里有一个问题:是否有一种简单的方法可以防止文件的卸载?当然,我们可以在脚本中添加一个自定义操作来在卸载之前备份文件,然后再添加另一个自定义操作来恢复它,但恕我直言,这个任务似乎有点过分,并且可能会干扰MSI注册过程的其他部分.
编辑:是的,该NeverOverwrite="yes"属性已经在V2中设置,行为就像我描述的那样.
我不认为在V2的组件参数中直接更改某些内容会有所帮助.也许有机会在卸载V1之前以某种方式在自定义操作中修改注册表,以便安装程序服务认为V1中的配置文件已安装Permanent="yes"?
尝试NeverOverwrite配置文件的属性
如果此属性设置为"yes",则如果组件的密钥路径文件或密钥路径注册表项已存在,则安装程序不会安装或重新安装该组件.
编辑
我刚刚在测试设置中对此进行了测试.起初它没有用,因为我RemoveExistingProducts在InstallInitialize序列之前安排了动作.这会在安装新产品之前删除旧产品,因此无法进行比较.
然而,当我将它设置为InstallFinalize它确实工作后,它将文件保留在那里,即使原始设置没有NeverOverwrite设置.这是我的两个测试示例
版本1.0.0.0
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="35d07bf8-a729-402d-83d6-fdc55799a3d5" Language="1033" Manufacturer="..." Name="test1" UpgradeCode="9773a278-068d-4fac-8241-4a5b7e54f15a" Version="1.0.0.0">
        <Package Compressed="no" InstallerVersion="200" />
        <Property Id="ALLUSERS" Value="1" />
        <Upgrade Id="9773a278-068d-4fac-8241-4a5b7e54f15a">
            <UpgradeVersion OnlyDetect="no" Property="REMOVEOLDVERSION" Maximum="1.0.0.0" IncludeMaximum="no" />
            <UpgradeVersion OnlyDetect="yes" Property="NEWERFOUND" Minimum="1.0.0.0" IncludeMinimum="no" />
        </Upgrade>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder" Name="ProgramFilesFolder">
                <Directory Id="INSTALLDIR" Name="test1">
                    <Component Id="New_Text_Document.txt" Guid="{CCA38D83-A890-4528-B11D-DA2E2DCDED93}" Feature="ProductFeature">
                        <File Id="New_Text_Document.txt" KeyPath="yes" Source="Harvest\ProgramFilesFolder\INSTALLDIR\New Text Document.txt" />
                    </Component>
                </Directory>
            </Directory>
        </Directory>
        <Feature Id="ProductFeature" Level="1" Title="CompletePackage" Description="The complete Product." Display="expand" />
        <CustomAction Id="NewerFound" Error="A later version of [ProductName] is already installed" />
        <InstallExecuteSequence>
            <Custom Action="NewerFound" After="FindRelatedProducts">NEWERFOUND</Custom>
            <RemoveExistingProducts After="InstallFinalize" />
        </InstallExecuteSequence>
        <UIRef Id="WixUI_Minimal" />
        <Media Id="1" />
        <UI />
    </Product>
</Wix>
版本1.0.1.0
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="1da36626-d760-4c4c-8a5c-3eb3841dbfd5" Language="1033" Manufacturer="..." Name="test1" UpgradeCode="9773a278-068d-4fac-8241-4a5b7e54f15a" Version="1.0.1.0">
        <Package Compressed="no" InstallerVersion="200" />
        <Property Id="ALLUSERS" Value="1" />
        <Upgrade Id="9773a278-068d-4fac-8241-4a5b7e54f15a">
            <UpgradeVersion OnlyDetect="no" Property="REMOVEOLDVERSION" Maximum="1.0.1.0" IncludeMaximum="no" />
            <UpgradeVersion OnlyDetect="yes" Property="NEWERFOUND" Minimum="1.0.1.0" IncludeMinimum="no" />
        </Upgrade>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder" Name="ProgramFilesFolder">
                <Directory Id="INSTALLDIR" Name="test1">
                    <Component Id="New_Text_Document.txt" Guid="{CCA38D83-A890-4528-B11D-DA2E2DCDED93}" Feature="ProductFeature" NeverOverwrite="yes">
                        <File Id="New_Text_Document.txt" KeyPath="yes" Source="Harvest\ProgramFilesFolder\INSTALLDIR\New Text Document.txt" />
                    </Component>
                </Directory>
            </Directory>
        </Directory>
        <Feature Id="ProductFeature" Level="1" Title="CompletePackage" Description="The complete Product." Display="expand" />
        <CustomAction Id="NewerFound" Error="A later version of [ProductName] is already installed" />
        <InstallExecuteSequence>
            <Custom Action="NewerFound" After="FindRelatedProducts">
NEWERFOUND</Custom>
            <RemoveExistingProducts After="InstallFinalize" />
        </InstallExecuteSequence>
        <UIRef Id="WixUI_Minimal" />
        <Media Id="1" />
        <UI />
    </Product>
</Wix>
| 归档时间: | 
 | 
| 查看次数: | 7758 次 | 
| 最近记录: |