I agree - this is an oversight in Votive.  Here was my workaround:

1) In the wix prebuild, add the following to create the transformed web configs:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe 
..\..\..\PathTo\MyWebApp.csproj /t:TransformWebConfig 
/p:Configuration=$(ConfigurationName) /noconlog /nologo

2) Disable automatic harvesting on My project reference, since Votive doesn't 
provide a field to specify a transform file  (another needed feature).

3) Instead, open the .wixproj file and add the following to call heat:

<ItemGroup>
  <HarvestProject Include="..\MyWebApp.csproj">
    <ProjectOutputGroups>Content;Binaries</ProjectOutputGroups>
    <Transforms>MyWebTransform.xslt</Transforms>
    <Link>MyWebApp.csproj</Link>
  </HarvestProject>
</ItemGroup>

4) For reference in this example, my directory structure looks like this:

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLLOCATION" Name="MyApp">
      <Directory Id="BINDIR" Name="Bin"/>
    </Directory>
  </Directory>
</Directory>

5) Create the xslt file referenced in step 3.  Note, I do a few other things 
here also:

<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:wix="http://schemas.microsoft.com/wix/2006/wi";>

  <!-- Default Template -->
  <xsl:template match="@*|*">
    <xsl:copy>
      <xsl:apply-templates select="@*" />
      <xsl:apply-templates select="*" />
    </xsl:copy>
  </xsl:template>

  <!-- Set the content root dir to INSTALLLOCATION -->
  <xsl:template match="wix:directoryr...@id='MyWebApp.Content']">
    <xsl:copy>
      <xsl:attribute name="Id">INSTALLLOCATION</xsl:attribute>
      <xsl:apply-templates select="*" />
    </xsl:copy>
  </xsl:template>

  <!-- Keep binary files in the BINDIR -->
  <xsl:template match="wix:directoryr...@id='MyWebApp.Binaries']">
    <xsl:copy>
      <xsl:attribute name="Id">BINDIR</xsl:attribute>
      <xsl:apply-templates select="*" />
    </xsl:copy>
  </xsl:template>

  <!-- Point to the correct source for the transformed web.config -->
  <xsl:template 
match="wix:fi...@source='$(var.MyWebApp.ProjectDir)\Web.config']">
    <xsl:copy>
      <xsl:attribute name="Compressed">yes</xsl:attribute>
      <xsl:apply-templates select="@Id" />
      <xsl:attribute 
name="Source">$(var.MyWebApp.ProjectDir)obj\$(var.MyWebApp.Configuration)\TransformWebConfig\transformed\Web.config</xsl:attribute>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>


That's it.  When you build, msbuild will transform the webconfig, then heat 
will use the xslt to point at it properly.




Matt Johnson MCPD, MCTS, MCSD, MCDBA
Director of Application Development
Time America, Inc.
ma...@timeamerica.com | www.timeamerica.com


-----Original Message-----
From: Rob Jarratt (MCS UK) [mailto:rjarr...@microsoft.com] 
Sent: Friday, May 07, 2010 12:28 AM
To: General discussion for Windows Installer XML toolset.
Subject: [WiX-users] Using web.config transformations in WiX

I would like to make use of the web.config transformations feature in 
combination with the integration of Heat in VS 2010. I know I can get the 
transformation output during the build, but if I use the Content project output 
group then the web.config gets included from the source directory rather than a 
transformed one. Is there a way to use the project output group and yet replace 
the web.config with the transformed one? I would also like to find a way to 
avoid this including the web.config.release and web.config.debug files.

Thanks

Rob

This email may contain confidential information. If you are not named on the 
addressee list, please take no action in relation to this email, do not open 
any attachment, and please contact the sender (details above) immediately.
Information in this email is provided in good faith. If you are a customer of 
Microsoft, please refer to the terms and conditions which cover the provision 
of support and consulting services to you/My organization. If you are not 
corresponding in the course of, or in connection with a Microsoft contract or 
programme with its own terms and conditions, please note that no liability is 
accepted by Microsoft for the contents of this mail.
Microsoft Limited (company number 01624297) is a company registered in England 
and Wales whose registered office is at Microsoft Campus, Thames Valley Park, 
Reading. RG6 1WG

------------------------------------------------------------------------------

_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------

_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to