1
votes

I'm creating a WIX setup for a Web Application. I used the setup to wix add-in to do this very fast. But how do I exclude the web.config out of the directory?

I don't want a filter on all the .config files, just a filter on the web.config. Thanks.

I created a test project called WebApplicationWix.

1
You could go to the wix projext's xml and simply delete the entries( the file itself and the installation command) for your web.config - Christian Sauer
The route you have taken (new vdproj converted to WiX with a tool) carries with it a lot of baggage and complexity. I suggest that you start fresh with a simple WiX project. - Tom Blodget
@Tom Well it has taken me indeed a lot of time to get everything to work but I guess less than when I was starting from scratch. I'm new with WIX and I read the documentation but was difficult. Do you have a test project for me from scratch with a Web Application and referenced class library? You could alter my test project. - LockTar
@ChristianSauer This files of the web application are harvested so I can't remove it from the Product file. Do you have a sample project? - LockTar
Try marking the file as "excluded" in Visual Studio setup project's file properties pane. - BBR

1 Answers

2
votes

Just be more specific in the filter in your transform. Remember the filter is done on the SRC value.

E.g. wix:Component[contains(wix:File/@Source, '*.config')] to wix:Component[contains(wix:File/@Source, '$(var.HostFileDir)\Web.config')]

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:msxl="urn:schemas-microsoft-com:xslt"
                exclude-result-prefixes="msxl"
                xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">

  <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes" />
  <xsl:strip-space elements="*" />

  <!-- Get harvest file details -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>

  <!-- Match and ignore Web.Config file-->
 <xsl:key name="config-search" match="wix:Component[contains(wix:File/@Source, '$(var.HostFileDir)\Web.config')]" use="@Id" />
  <xsl:template match="wix:Component[key('config-search', @Id)]" />
  <xsl:template match="wix:ComponentRef[key('config-search', @Id)]" />

</xsl:stylesheet>