Wix Harvest: Same Component/File ID when files are in different folders

自闭症网瘾萝莉.ら 提交于 2019-12-06 05:53:39

The ID will be the same because you are using -srd, suppress root directory. In this case, the path used for generating the ID will be only the filename, generating the same ID for files with same name.

You have two alternatives:

1) Use a transform right when you execute heat to harvest the files with -t.

2) Use XslTransform task (.NET 4) after harvesting to rename the ID to one like File_2012_AL3Util and File_2008_AL3Util.

You can apply this XSL to your file. In the example below, the element will be removed if it matches 'MyFile' for file name and 'MyID' for directory id.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns:wi="http://schemas.microsoft.com/wix/2006/wi">

  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

  <!-- Matches both directory name and file name. -->
  <!-- Matches any Component that has its @Directory with same @Id as Directory 'MyID'. -->
  <!-- Function ends-with does not work with heat. -->
  <xsl:template match="//wi:Component[@Directory=//wi:Directory[@Name='MyID']/@Id and substring(wi:File/@Source, string-length(wi:File/@Source) - string-length('MyFile') + 1) = 'MyFile']" />

</xsl:stylesheet>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!