Question

I am following the steps given in the below link to create the installer. And I am new to Wix Installer.

Creating WIX Installer using DotNet

Using steps given by the above article I am able to create Wix project and it is working fine aswell.

Here I am using Xsl to control the files which i don't want to include.

<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)]" />

I am Creating WIX Installer for dotNet web application.So I am publishing the application and assigning the path to .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>

The Problem is it is removing all .XML files which are in the project directory. I want to remove only from specific directory (\bin). is that possible ? If Yes, Guide Me..

Was it helpful?

Solution

It is still unclear how you know which files are in the bin folder, but I'll give it a try.

In case the Source attributes contains a full file path:

<xsl:key name="xml-search" match=" wix:Component[contains(wix:File/@Source, '.xml') and contains(wix:File/@Source,'\bin')]" use ="@Id " />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top