我正在按照以下链接中给出的步骤创建安装程序。我是 Wix 安装程序的新手。
Creating WIX Installer using DotNet
使用上述文章中给出的步骤,我能够创建 Wix 项目并且它也运行良好。
这里我使用 Xsl 来控制我不想包含的文件。
<xsl:key name="xml-search" match=" wix:Component[contains(wix:File/@Source, '.xml')]" use ="@Id " />
<!--Match and ignore leftover .xml files on developer machines -->
<xsl:template match=" wix:Component[key('xml-search', @Id)]" />
<xsl:template match=" wix:ComponentRef[key('xml-search', @Id)]" />
我正在为 dotNet web 应用程序创建 WIX 安装程序。所以我正在发布应用程序并将路径分配给 .Wixproj。
<Target Name="BeforeBuild">
<HeatDirectory NoLogo="$(HarvestDirectoryNoLogo)"
SuppressAllWarnings="$(HarvestDirectorySuppressAllWarnings)"
SuppressSpecificWarnings="$(HarvestDirectorySuppressSpecificWarnings);"
ToolPath="$(WixToolPath)"
TreatWarningsAsErrors="$(HarvestDirectoryTreatWarningsAsErrors)"
TreatSpecificWarningsAsErrors="$(HarvestDirectoryTreatSpecificWarningsAsErrors)"
VerboseOutput="$(HarvestDirectoryVerboseOutput)" AutogenerateGuids="false"
GenerateGuidsNow="true" OutputFile="Components.wxs"
SuppressFragments="$(HarvestDirectorySuppressFragments)"
SuppressUniqueIds="$(HarvestDirectorySuppressUniqueIds)"
Directory="D:\wixTest\Custom\WebApplication" ComponentGroupName="C_CommonAssemblies"
Transforms="WIXInstaller.xslt" DirectoryRefId="TARGETDIR" KeepEmptyDirectories="false"
PreprocessorVariable="var.SourceDir" SuppressCom="%(HarvestDirectory.SuppressCom)"
SuppressRootDirectory="true" SuppressRegistry="%(HarvestDirectory.SuppressRegistry)">
</HeatDirectory>
问题是它正在删除项目目录中的所有 .XML 文件。我只想从特定目录 (\bin) 中删除。那可能吗 ?如果是,请指导我..
最佳答案
目前还不清楚您如何知道 bin
文件夹中有哪些文件,但我会试一试。
如果 Source
属性包含完整的文件路径:
<xsl:key name="xml-search" match=" wix:Component[contains(wix:File/@Source, '.xml') and contains(wix:File/@Source,'\bin')]" use ="@Id " />
关于.net - Wix 安装程序和 XSLT - 省略特定目录中的某些文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21180054/