Wix 更新绑定重定向值

问题描述 投票:0回答:3
wix wix3
3个回答
0
投票

您的元素路径不正确。这不是有效的 XPath 查询(具有特定于 msi 的转义)。您可能需要一个前导的正斜杠。


0
投票

这就是这个问题的解决方案,如果其他人也遇到这个问题!

    <util:XmlFile Id="Config"
      Action="setValue"
      ElementPath="configuration/runtime/assemblyBinding/dependentAssembly[\[]assemblyIdentity/@publicKeyToken='89845dcd8080cc91'[\]]/bindingRedirect/@newVersion"
      File="[INSTALLFOLDER]\app.config"
      Value="13.0.0.0"/>

并且配置文件中的 assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" 需要更改为 assemblyBinding


0
投票

@JWoodley13,你是我的英雄,非常感谢你的回答。 为了使其与 WiX v4.0.2 一起使用,我还需要安装全局工具并安装 WixToolset.Util.wixext 扩展,然后才能在 .wixproj 中将其作为 PackageReference 引用。

在命令行上:

dotnet tool install --global wix --version 4.0.2
wix extension add -g WixToolset.Util.wixext

在.wixproj中:

<ItemGroup>
  <PackageReference Include="WixToolset.Util.wixext" Version="4.0.2" />
</ItemGroup>

.wxs
文件中,导入更新的 wxs 和 wxs/util 命名空间:

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
     xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">

我也调整了 xpath 以使用包名称:

      <Component Id="ChangeConfig" Guid="18C80C2F-D0CC-486D-A80A-23646BBAB8FF">
        <util:XmlFile Id="Config"
          Action="setValue"
          ElementPath="configuration/runtime/assemblyBinding/dependentAssembly[\[]assemblyIdentity/@name='Newtonsoft.Json'[\]]/bindingRedirect/@newVersion"
          File="[INSTALLFOLDER]\app.config"
          Value="13.0.0.0"/>
      </Component>
© www.soinside.com 2019 - 2024. All rights reserved.