Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Msbuild 使用一个C#COM dll获取多个文件_Msbuild_Wix_Heat - Fatal编程技术网

Msbuild 使用一个C#COM dll获取多个文件

Msbuild 使用一个C#COM dll获取多个文件,msbuild,wix,heat,Msbuild,Wix,Heat,我正在编译一个WiX安装程序并使用Heat来获取我的文件,但我遇到了一个问题,我正在获取的目录包含1个C#COM dll。我需要在这个问题上运行regasm。我的wix项目文件中包含以下内容以获取文件: <HeatDirectory OutputFile="%(ProjectReference.Filename).wxs" Directory="..\ExactaMobilePublish\" DirectoryRefId="

我正在编译一个WiX安装程序并使用Heat来获取我的文件,但我遇到了一个问题,我正在获取的目录包含1个C#COM dll。我需要在这个问题上运行regasm。我的wix项目文件中包含以下内容以获取文件:

<HeatDirectory OutputFile="%(ProjectReference.Filename).wxs" 
               Directory="..\ExactaMobilePublish\" 
               DirectoryRefId="INSTALLFOLDER" 
               ComponentGroupName="%(ProjectReference.Filename)" 
               SuppressUniqueIds="true" 
               SuppressCom="false" 
               SuppressFragments="true" 
               SuppressRegistry="false" 
               SuppressRootDirectory="true" 
               AutoGenerateGuids="false" 
               GenerateGuidsNow="true" 
               ToolPath="$(WixToolPath)" 
               PreprocessorVariable="var.BasePath" />

我可能可以通过使用xslt转换将此文件从上面的目录中排除,但这似乎有些过分。

我最终按照上面的编辑建议解决了这个问题。我使用
HeatFile
获取单个文件,并使用xslt转换从
HeatDirectory
获取中排除该文件

我的项目文件中包含以下内容:

<HeatDirectory OutputFile="%(ProjectReference.Filename).wxs" 
               Directory="..\ExactaMobilePublish\" 
               DirectoryRefId="INSTALLFOLDER" 
               Transforms="ExcludeExactaDatabaseAccess.xslt" 
               ComponentGroupName="%(ProjectReference.Filename)" 
               SuppressUniqueIds="true" 
               SuppressCom="true" 
               SuppressFragments="true" 
               SuppressRegistry="true" 
               SuppressRootDirectory="true" 
               AutoGenerateGuids="false" 
               GenerateGuidsNow="true" 
               ToolPath="$(WixToolPath)" 
               PreprocessorVariable="var.BasePath" />
<HeatFile OutputFile="ExactaDatabaseAccess.wxs" 
          File="..\ExactaMobilePublish\bin\ExactaDatabaseAccess.dll" 
          DirectoryRefId="MOBILEBIN" 
          ComponentGroupName="ExactaDatabaseAccess" 
          SuppressUniqueIds="true" 
          SuppressCom="false" 
          SuppressFragments="true" 
          SuppressRegistry="false" 
          SuppressRootDirectory="true" 
          AutoGenerateGuids="false" 
          GenerateGuidsNow="true" 
          ToolPath="$(WixToolPath)" 
          PreprocessorVariable="var.ExactaMobileBinBasePath" />

我使用了以下xslt转换:

<?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"
      xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">

  <!-- Copy all attributes and elements to the output. -->
  <xsl:template match="@*|*">
    <xsl:copy>
      <xsl:apply-templates select="@*" />
      <xsl:apply-templates select="*" />
    </xsl:copy>
  </xsl:template>

  <xsl:output method="xml" indent="yes" />

  <!-- Search directories for the components that will be removed. -->
  <xsl:key name="dll-search" match="wix:Component[@Id = 'ExactaDatabaseAccess.dll']" use="descendant::wix:File/@Id"/>

  <!-- Remove components. -->
  <xsl:template match="wix:Component[@Id='ExactaDatabaseAccess.dll']" />

  <!-- Remove componentsrefs referencing components in those directories. -->
  <xsl:template match="wix:ComponentRef[key('dll-search', @Id)]" />
</xsl:stylesheet>

<?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"
      xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">

  <!-- Copy all attributes and elements to the output. -->
  <xsl:template match="@*|*">
    <xsl:copy>
      <xsl:apply-templates select="@*" />
      <xsl:apply-templates select="*" />
    </xsl:copy>
  </xsl:template>

  <xsl:output method="xml" indent="yes" />

  <!-- Search directories for the components that will be removed. -->
  <xsl:key name="dll-search" match="wix:Component[@Id = 'ExactaDatabaseAccess.dll']" use="descendant::wix:File/@Id"/>

  <!-- Remove components. -->
  <xsl:template match="wix:Component[@Id='ExactaDatabaseAccess.dll']" />

  <!-- Remove componentsrefs referencing components in those directories. -->
  <xsl:template match="wix:ComponentRef[key('dll-search', @Id)]" />
</xsl:stylesheet>