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