.net - 使用 WIX 时删除单元测试 dll 文件

标签 .net msbuild wix windows-installer

我正在尝试使用 WIX 为我的项目创建一个 MSI。我让 HEAT 指向正确的目录,它输出的文件是正确的,但出于某种原因,当我在其上实际运行 MSBuild 时,它也给了我所有的单元测试 dll 文件。

有人知道如何从构建过程中删除它们吗?

最佳答案

一种选择是编写一个 XSL 转换来修改生成的 HEAT 输出(例如删除不需要的文件):

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

要删除特定文件,您的 xsl 可能类似于:

<?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。

关于.net - 使用 WIX 时删除单元测试 dll 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7906578/

相关文章:

c# - 以管理员身份运行 Visual Studio 看不到映射的网络驱动器

c# - 使用评估的 MSBuild 属性值以编程方式强制更新 Visual Studio Intellisense

powershell - 从TFSBuild.Proj文件运行Powershell脚本

wix - 将 .reg 文件添加到注册表 WIX

WIX - 如何有选择地卸载 <Bundle>

wix - 如何在 Wix 安装程序中检查系统是 Windows 7 还是 Windows Server 2008 R2?

.net - 无法在 Windows XP 下运行 Light Switch 2012 程序

.net - 如何在我的 .NET 应用程序中找到用户的字体?

c# - 我可以配置对象类型吗?

c# - Webdeploy权限问题