[wix-users] Applying patch with heat

Phill Hogland phill.hogland at rimage.com
Thu Jan 12 07:29:11 PST 2017


With regard to #2, this is not a direct answer but code I use to set some attributes.

<?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'
    xmlns='http://schemas.microsoft.com/wix/2006/wi'
    exclude-result-prefixes='wix'
    >
  <xsl:output method="xml" indent="yes" />

  <!-- Identity transform. -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>

  <xsl:template match="//wix:Component[contains(@Id,'ReadMe.txt')]">
    <wix:Component>
      <xsl:copy-of select="@*" />
      <wix:RegistryValue Root="HKMU" Key="!(wix.PropertiesRegKey)" Name="SetupsDirReadMe_Ver" Value="[ProductVersion]" Type="string" KeyPath="yes" />
      <xsl:apply-templates select="node()" />
    </wix:Component>
  </xsl:template>

  <xsl:template match="//wix:File[contains(@Id,'ReadMe.txt')]">
    <wix:File>
      <xsl:copy-of select="@*" />
      <xsl:attribute name="KeyPath">
        <xsl:text>no</xsl:text>
      </xsl:attribute>
    </wix:File>
  </xsl:template>


  <xsl:template match="/">
    <xsl:comment>!!!DO NOT EDIT!!! Generated by HarvestDirectory target.</xsl:comment>
    <xsl:apply-templates />
  </xsl:template>

</xsl:stylesheet>


________________________________
From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Phill Hogland <phill.hogland at rimage.com>
Sent: Thursday, January 12, 2017 9:10:16 AM
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] Applying patch with heat

For #1, I seen many similar examples in google resuts and there may be several approaches, but the approach I uses is something like:


<?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'
    xmlns:fire='http://schemas.microsoft.com/wix/FirewallExtension'
    xmlns='http://schemas.microsoft.com/wix/2006/wi'
    exclude-result-prefixes='wix'
    >

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

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

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

</xsl:stylesheet>


For #2 it would take some more research.  Maybe something like this will help

http://stackoverflow.com/questions/18078679/how-to-add-attribute-to-a-parent-node-conditioned-by-a-child-element-with-inden
[https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon@2.png?v=73d79a89bded]<http://stackoverflow.com/questions/18078679/how-to-add-attribute-to-a-parent-node-conditioned-by-a-child-element-with-inden>

How to add attribute to a parent-node conditioned by a ...<http://stackoverflow.com/questions/18078679/how-to-add-attribute-to-a-parent-node-conditioned-by-a-child-element-with-inden>
stackoverflow.com
Like in this other question I have difficulty to express simple things with XSLT1... In a xsl:stylesheet I have this "identity like" transform to add an attribute ...



________________________________
From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Helge Kruse <Helge.Kruse at gmx.net>
Sent: Thursday, January 12, 2017 3:54:49 AM
To: WiX Toolset Users Mailing List
Subject: [wix-users] Applying patch with heat

While harvesting files from a directory I failed to meet two requirements:
- Some files shall be omitted. The selection shall be on the file name.
e.g. all .PDB files should be excluded for the installation.
- Files containing a .NET assembly shall have the corresponding
attributes: Assembly, AssemblyManifest, AssemblyApplication. This should
register these files in the GAC.

I could exclude the files by creating a temporary folder, copy only
required files to the temporary, and call heat with that folder. But
since the missing attributes are still an open issue, I though about the
Transform option of heat.


The heat command allows to apply a patch based on an XSL file to the
harvester output. So I could invoke it like

  heat dir SomeFolderName -o xx.wxs -t myTransform.xsl

Unfortunately the page
http://wixtoolset.org/documentation/manual/v3/overview/heat.html shows
only the possibility to perform a transform, but I could not find an
example for this.

I would like to do two operations.
(1) <Component> nodes containing a file with a specific extension (.pdb)
should be removed.
(2) <File> nodes with specific extensions (.exe, .dll) should get
additional attributes:
- Assembly=".net"
- AssemblyManifest="[File/Name]"
- AssemblyApplication="[File/Name]"
Where [File/Name] stands for the name of the file at the installed file
name.

I am not experienced with XML transform language. Do you know examples
or tutorials how this can be implemented?

Is there a different way to add the attributes like "Assembly" to files
during harvesting?

Regards,
Helge

____________________________________________________________________
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