WIX util:xmlfile文件名是Source属性

Val*_*Val 5 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>
Run Code Online (Sandbox Code Playgroud)

这不起作用.

<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>
Run Code Online (Sandbox Code Playgroud)

当.msi与第一个组件一起执行时,一切都很好.在第二个版本中,返回错误"错误25531.无法打开XML文件..."

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

有什么区别可能是什么建议?

Chr*_*ski 9

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

[#config] //which will refer to the File Id
Run Code Online (Sandbox Code Playgroud)

代替

[INSTALLDIR]prod-config.xml
Run Code Online (Sandbox Code Playgroud)