使用WIX当拆卸单元测试的dll文件单元测试、文件、WIX、dll

2023-09-05 01:20:18 作者:内心深处是伱

我想创建一个MSI使用WIX我的项目。我得热指向正确的目录和它吐出该文件是正确的,但由于某些原因,当我实际在其上运行的MSBuild它也给我了我所有的单元测试的dll文件。

I'm trying to create an MSI for my project using WIX. I've got HEAT pointing to the correct directory and the file it spits out is correct, but for some reason when I actually run MSBuild on it it's also giving me all of my unit test dll files.

任何人有任何想法如何删除这些构建过程?

Anyone have any idea how to remove those from the build process?

推荐答案

一个办法是写一个XSL转换修改所产生的热量输出(例如,删除不需要的文件):

One option would be to write an XSL transformation modifying the generated HEAT output (e.g. removing the unwanted files):

heat.exe dir <other arguments> -t my.xsl

要删除特定文件的XSL可能是这样的:

To remove a specific file your xsl could be something like:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="node()[child::node()[@Source='UnwantedAssembly.dll']]" />
</xsl:stylesheet>

这个方法可以让你做出其他改变文件中。虽然仅删除不需要的文件,它通常比较简单,只是从构建目录中删除它们,或将所需的文件到另一个目录并运行HEAT那里。

This approach allows you to make other changes to the file as well. Though to only remove unwanted files it's usually simpler to just delete them from the build directory or to move the desired files into another directory and run HEAT there.