Adding HEAT output to the GAC

June 3, 2010 • Simon ReindlDevelopment

There are situations (infrastructure component used across the enterprise is one example) where it is more useful to put the assembly in to the GAC.

Using Heat, a transform needs to be used that will add the assembly=".net" to the wixobj.

In the wixproj File, add a transforms line:

  <ItemGroup>

    <HeatProject Include="@(ProjectReference->'%(FullPath)')">

      <ProjectOutputGroups>Binaries;Symbols;Documents;Satellites;Content</ProjectOutputGroups>

      <Transforms>....BuildUtilitiesXSLTHeatGAC.xslt</Transforms>

    </HeatProject>

  </ItemGroup>

 

 

The XSLT file contents:

 

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

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

  <xsl:output method="xml" indent="yes"/>

 

  <!-- Start the processing from the root copying-->

  <xsl:template match="wix:*|@*">

    <xsl:copy>

      <xsl:apply-templates select="text()|*|@*" />

    </xsl:copy>

  </xsl:template>

 

  <!-- Search for elements that have a file source, and add an attribute that will let wix GAC them-->

  <xsl:template match="*">

    <xsl:element name="File" namespace="http://schemas.microsoft.com/wix/2006/wi">

      <xsl:attribute name="Id">

        <xsl:value-of select="@Id"/>

      </xsl:attribute>

      <xsl:attribute name ="Source">

        <xsl:value-of select="@Source"/>

      </xsl:attribute>

      <xsl:attribute name="Assembly">.net</xsl:attribute>

      <xsl:attribute name="KeyPath">yes</xsl:attribute>

    </xsl:element>

  </xsl:template>

 

</xsl:stylesheet>

This will harvest all the output assemblies and flag them to be installed in to the GAC