WiX - 在两个不同位置安装相同的文件

2024-01-16

在我的安装程序中,我有两个可选功能,它们是同一软件版本 5 和 6 的插件。他们将相同的文件(相同的名称、相同的二进制内容)安装到应用程序的“plugins”文件夹中。

但我有以下错误:

C:\Users\FooBar\Documents\project\project.wxs(281):错误 LGHT0204:ICE30:目标文件“0egx-0x3.dll | appv5plugin.dll”是 由两个不同的组件安装在“[TARGETDIR]\plugins\”中 LFN 系统:“Comp_ThisAppV5_plugin”和 'Comp_ThisAppV6_plugin'。这会破坏组件引用计数。

我努力了:

  • 使用相同的文件,并且两者components用它作为Source
  • 将文件复制到两个项目子文件夹中,每个子文件夹一个component

但剧照是,WiX 拒绝建造。

wxs 文件详细信息:

  • 在注册表中搜索 TheApp v5 和 v6 的安装目录:

    <Property Id="PROP_APPV5PATH">
        <RegistrySearch Id='RegSearch_AppV5Path' Type='raw' Root='HKLM' Key='SOFTWARE\TheCompany\TheApp\5.0' Name='Installdir' Win64="yes"/>
    </Property>
    <Property Id="PROP_APPV6PATH">
        <RegistrySearch Id='RegSearch_3AppV6Path' Type='raw' Root='HKLM' Key='SOFTWARE\TheCompany\TheApp\6.0' Name='Installdir' Win64="yes"/>
    </Property>
    
  • 单独的组件:

    <Directory Id="DIR_APPV5">
        <Directory Id="Dir_AppV5Plugins" Name="plugins">
            <Component Id="Comp_ThisAppV5_plugin" Guid="*">
                <File Id="appv5plugin_dll" Source="files\plugins\appv5\app_plugin.dll" KeyPath="yes"/>
            </Component>
        </Directory>
    </Directory>
    
    <Directory Id="DIR_APPV6">
        <Directory Id="Dir_AppV6Plugins" Name="plugins">
            <Component Id="Comp_ThisAppV6_plugin" Guid="*">
                <File Id="appv6plugin_dll" Source="files\plugins\appv6\app_plugin.dll" KeyPath="yes"/>
            </Component>
        </Directory>
    </Directory>
    
  • 两个安装目录:

    <SetDirectory Id="DIR_APPV5" Value="[PROP_APPV5PATH]" /> 
    <SetDirectory Id="DIR_APPV6" Value="[PROP_APPV6PATH]" /> 
    
  • 两个独立的功能

    <Feature Id="Feat_ThisAppV5_plugin" Title="Plugin for App V5" ConfigurableDirectory="DIR_APPV5" Level="1000" AllowAdvertise='no' InstallDefault='local' Absent='allow'>
        <ComponentRef Id="Comp_ThisAppV5_plugin"/>
    </Feature>
    <Feature Id="Feat_ThisAppV6_plugin" Title="Plugin for App V6" ConfigurableDirectory="DIR_APPV6" Level="1000" AllowAdvertise='no' InstallDefault='local' Absent='allow'>
        <ComponentRef Id="Comp_ThisAppV6_plugin"/>
    </Feature>
    

尝试为每个文件提供一个明确的 ShortName 值(显然是唯一且不同的)。我不完全确定,但问题可能是短文件名的冲突。 MSI 文件的文件表中的每个值是什么?

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

WiX - 在两个不同位置安装相同的文件 的相关文章

随机推荐