xml - WIX 实用程序 :xmlfile File name is Source attribute

标签 xml wix

我正在从 Wise Installer 迁移到 WIX,并使用 util:xmlfile 更新配置 xml 文件。

这有效。

<Component Id="config" Guid="*">
  <File Id="config" Source="..\Source\Desktop\prodconfig.xml" KeyPath="yes" Vital="yes" />
    <util:XmlFile 
      Id="_PORT_" File="[INSTALLDIR]prodconfig.xml"  
      Action="setValue" 
      Name="Port" Value="[PORT]" 
      ElementPath="//Configuration/CommConnectionPools/CommConnectionPool" 
      Sequence='1' />
  </File>
</Component>

这是行不通的。

<Component Id="config" Guid="*">
  <File Id="config" Source="..\Source\Desktop\prod-config.xml" KeyPath="yes" Vital="yes" />
    <util:XmlFile 
      Id="_PORT_" File="[INSTALLDIR]prod-config.xml"  
      Action="setValue" 
      Name="Port" Value="[PORT]" 
      ElementPath="//Configuration/CommConnectionPools/CommConnectionPool" 
      Sequence='1' />
  </File>
</Component>

当 .msi 与第一个组件一起执行时,一切正常。在第二个版本中,返回错误“Error 25531. Failed to open XML file...”

据我所知,唯一的区别是文件名中的连字符。

有什么不同的建议吗?

最佳答案

尝试使用组件的 ID 而不是硬编码名称

[#config] //which will refer to the File Id

代替

[INSTALLDIR]prod-config.xml

关于xml - WIX 实用程序 :xmlfile File name is Source attribute,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19796877/

相关文章:

visual-studio-2010 - Visual Studio WiX安装程序项目在Rebuild上删除MSI输出

c# - WiX 安装程序将 dll 包含到 msi 中

c# - 打印转换后的 XML

java - 如何使用JAXB解析xml?

c# - 使用 XmlSerializer 反序列化 xml 文件时出错

c# - wix:设置 RegistryKey Root HKMU

wix - wix v3.8重大升级时如何保留配置文件?

javascript - 想知道是否有可用于 xml 的 .html() 等价物?

java - Android 中使用蓝牙进行数据传输

WiX 在卸载时删除文件但不更新