[wix-users] Transform for HarvestDirectory Visual Studio{

Steven Packer stevenp at fps-gold.com
Fri Oct 30 12:33:18 PDT 2015


Thank you for this information. It works great! Now I will be studying it
for a while to see if I can figure out how it works.  I have a lot to learn!

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of
Phill Hogland
Sent: Friday, October 30, 2015 11:51 AM
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] Transform for HarvestDirectory Visual Studio{

I'm sorry here is the transform (which I have posted in the past) <?xml
version="1.0" encoding="utf-8"?>
<!--  Interesting Code from this post:
http://stackoverflow.com/questions/19515397/deploy-multiple-wcf-webservices-
with-wix-toolset-wrong-svc-files
which I then modified by changing the search and replace, to look for
'!wix.' and replace with'!(bindpath.'.
This change allows me to us %HarvestDirectory.PreprocessorVariable to
specify the bindpath name.-->

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
        xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
        exclude-result-prefixes="msxsl">
  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>
    
  <!-- Always strip these files - not specifically related to binding. -->
  <xsl:key name="thumbs.db-search"
match="wix:Component[contains(wix:File/@Source, 'Thumbs.db')]" use="@Id" />
  <xsl:template match="wix:Component[key('thumbs.db-search', @Id)]" />
  <xsl:template match="wix:ComponentRef[key('thumbs.db-search', @Id)]" />

  <xsl:key name="svn-search" match="wix:Component[contains(wix:File/@Source,
'*.svn')]" use="@Id" />
  <xsl:template match="wix:Component[key('svn-search', @Id)]" />
  <xsl:template match="wix:ComponentRef[key('svn-search', @Id)]" />

  <!-- Support using bindpath names. -->
  <xsl:template name="string-replace-all">
    <xsl:param name="text" />
    <xsl:param name="replace" />
    <xsl:param name="by" />
    <xsl:choose>
      <xsl:when test="contains($text, $replace)">
        <xsl:value-of select="substring-before($text,$replace)" />
        <xsl:value-of select="$by" />
        <xsl:call-template name="string-replace-all">
          <xsl:with-param name="text"
select="substring-after($text,$replace)" />
          <xsl:with-param name="replace" select="$replace" />
          <xsl:with-param name="by" select="$by" />
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$text" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="@Source['!(wix.']" >

    <xsl:attribute name="Source">

      <xsl:variable name="projectName">
        <xsl:value-of
select="/wix:Wix/wix:Fragment/wix:ComponentGroup/@Id"/>
      </xsl:variable>

      <xsl:call-template name="string-replace-all">
        <xsl:with-param name="text" select="." />
        <xsl:with-param name="replace" select="'!(wix.'" />
        <xsl:with-param name="by" select="'!(bindpath.'" />
      </xsl:call-template>

    </xsl:attribute>

  </xsl:template>

</xsl:stylesheet>

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of
Steven Packer
Sent: Friday, October 30, 2015 12:26 PM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Subject: [wix-users] Transform for HarvestDirectory Visual Studio{

Hi,

 

I have created a VS .wixproj and have added a Harvestdirectory to the Target
of the project.  I have been successful in harvesting the files and building
the msi.  However I am using PreprocessorVariable of wix.mysource which
generates 

!(wix.mysource)\???.

 

I am trying to write a transform that will substitute !(bindpath. For !(wix.
I am having a great deal of trouble figuring out how this is done.  I am new
to wix and .xsl.  Can anyone give me an example of how I might accomplish
this task?

 

Steven

 


____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant
http://www.firegiant.com/

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant
http://www.firegiant.com/




More information about the wix-users mailing list