如何从热 (WiX) 收获中排除 SVN 文件?
我讨厌重复现有的问题,但提供的答案不起作用:
这是我的 .wxs 的样子:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="SDKCONTENTDIR">
<Directory Id="dirE2EC21E8B765C611E918FB22F30721D1" Name=".svn" />
<Directory Id="dir7DC42F44E7FE9E20277B180A353D0263" Name="bin" />
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="sdkContent">
<Component Id="cmp5E86312F0CA2C53B8173AECD6A428747" Directory="dirE2EC21E8B765C611E918FB22F30721D1" Guid="{E87F312D-9DA2-4A68-B6C5-BCE2FF90720C}">
<File Id="filB766A28A7577EB4311FD03CD707BC211" KeyPath="yes" Source="$(var.publishContentDir)\.svn\all-wcprops" />
</Component>
<Component Id="cmp6EF52B3E331F226299060D45F533DC07" Directory="dirE2EC21E8B765C611E918FB22F30721D1" Guid="{5EA6AB2D-20C3-4B07-8E0A-7C28135BE922}">
<File Id="fil83205196F05211A66F9D25A7A5496FBA" KeyPath="yes" Source="$(var.publishContentDir)\.svn\entries" />
</Component>
...
我正在使用此 .xsl 代码来排除:
<xsl:key name="svn-search" match="wix:Component[ancestor::wix:Directory/@Name = '.svn']" use="@Id" />
<xsl:template match="wix:Directory[@Name='.svn']" />
<xsl:template match="wix:Component[key('svn-search', @Id)]" />
但我收到许多“错误 48 未解决的参考”符号”错误,因为它没有删除所有子元素。
有想法吗?
I hate to practically duplicate existing questions, but the supplied answers haven't worked:
Here's what my .wxs looks like:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="SDKCONTENTDIR">
<Directory Id="dirE2EC21E8B765C611E918FB22F30721D1" Name=".svn" />
<Directory Id="dir7DC42F44E7FE9E20277B180A353D0263" Name="bin" />
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="sdkContent">
<Component Id="cmp5E86312F0CA2C53B8173AECD6A428747" Directory="dirE2EC21E8B765C611E918FB22F30721D1" Guid="{E87F312D-9DA2-4A68-B6C5-BCE2FF90720C}">
<File Id="filB766A28A7577EB4311FD03CD707BC211" KeyPath="yes" Source="$(var.publishContentDir)\.svn\all-wcprops" />
</Component>
<Component Id="cmp6EF52B3E331F226299060D45F533DC07" Directory="dirE2EC21E8B765C611E918FB22F30721D1" Guid="{5EA6AB2D-20C3-4B07-8E0A-7C28135BE922}">
<File Id="fil83205196F05211A66F9D25A7A5496FBA" KeyPath="yes" Source="$(var.publishContentDir)\.svn\entries" />
</Component>
...
I'm using this .xsl code to exclude:
<xsl:key name="svn-search" match="wix:Component[ancestor::wix:Directory/@Name = '.svn']" use="@Id" />
<xsl:template match="wix:Directory[@Name='.svn']" />
<xsl:template match="wix:Component[key('svn-search', @Id)]" />
But I'm getting many "Error 48 Unresolved reference to symbol" errors as its not removing all child elements.
Ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我也有同样的问题,找到了你的答案。但是,我对需要按名称指定 .svn 文件夹的子目录感到不满意。如果 .svn 目录将来改变结构,或者如果我故意有一个名为 tmp 的目录,这可能会中断...
当我针对我的 xml 运行 xsl 时,我还注意到周围散布着一些目录片段。由于强迫症并想要清理它,我注意到 heat.exe 有一个“抑制碎片”的选项。实际效果是使 Directory 标记实际上相互嵌套,这使得编写 xsl 文件变得更加容易。
从嵌套标签结构中删除 .svn 目录后,我仍然遇到 ComponentRefs 指向组件 ID 的问题,这些组件 ID 及其包含的目录已被删除。作为一名 xsl 菜鸟,我不得不进行一些挖掘,但发现我可以在 xsl:key 的 use 属性中使用“descendant::”。
简而言之,这是我的解决方案。请注意,我实际上还没有尝试用它构建 MSI;一两天后就会出现。但即使它并不完美,至少这可能会帮助其他遇到同样问题的人...
使用:heat.exe dir source -t exceptsvn.xsl -sfrag -o files.wxs
I had the same question, and found your answer. However, I was unhappy with the need to specify the subdirectories of the .svn folder by name. This can break if the .svn directory changes structure in the future, or if I had a directory named tmp on purpose...
When I ran your xsl against my xml, I additionally noticed that there were some directory fragments scattered around. Being OCD and wanting to clean that up, I noticed that heat.exe has an option to "suppress fragments". The actual effect was to make Directory tags actually nest under each other, which makes writing an xsl file much easier.
After deleting .svn directories from the nested tag structure, I still had a problem with ComponentRefs pointing to Component IDs that had been removed along with their containing directories. Being an xsl noob myself, I had to do a little digging, but found that I could use "descendant::" in the use attribute of xsl:key.
In short, here is my solution. Note, I have not actually yet tried to build the MSI with it just yet; that will come in a day or two. But even if it isn't perfect, at least this might help someone else with the same problem...
Use: heat.exe dir source -t excludesvn.xsl -sfrag -o files.wxs
这是我的工作内容:
Here is what I got working:
您会收到“无法解析的符号”错误,因为您过滤掉了 Component 元素,但保留了 ComponentRef 元素。因此,这些元素仍然是孤立的,并且引用缺失的 Component 元素。这会被 WiX 编译器捕获。
正如您现在可能已经猜到的,还要过滤掉相应的 ComponentRef 元素。希望这有帮助。
You get the "unresolved symbol" error because you filter out the Component elements, but leave the ComponentRef elements as is. Hence, those elements remain orphaned and reference missing Component elements. This gets caught by the WiX compiler.
As you probably guessed by now, filter out the corresponding ComponentRef elements as well. Hope this helps.