wix

is it necessary using transforms?


I have old wix setup project.

I converted it to the v4 version using HeatWave But the project still uses things that I don't know if they need forexample XSLT - Transformation

What do You think, is it necessary ?

<HeatDirectory Transforms="$(ProjectDir)\Components.xslt" OutputFile="ComponentsGenerated.wxs" DirectoryRefId="TARGETDIR" ComponentGroupName="PublishedComponents" SuppressUniqueIds="false" SuppressCom="true" Directory="..\SposOnboard.Application\bin\$(Configuration)\" SuppressFragments="true" SuppressRootDirectory="true" AutogenerateGuids="false" GenerateGuidsNow="true" PreprocessorVariable="var.BasePath" SuppressRegistry="true" />

My transform file looks like that:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:wix="http://wixtoolset.org/schemas/v4/wxs"
                xmlns="http://wixtoolset.org/schemas/v4/wxs"
                exclude-result-prefixes="wix">

  <!--Load all components-->
  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>

  <!--Filter components-->
  <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)]" />

  <!--Override SAMPLE.exe component-->
  <xsl:key name="sampleExe-search" match="wix:Component[wix:File/@Source='$(var.BasePath)\SAMPLE.exe']" use="@Id" />  
  <xsl:template match="wix:Component[key('sampleExe-search', @Id)]" >
    <Component Id="cmpSample" Guid="{@Guid}">
      <File Id="filSample" Source="$(var.BasePath)\SAMPLE.exe"/>
      <ProgId Id="SAMPLE Weather file" Description="Weather information used to route ships over the oceans" Icon="Sample.exe" IconIndex="0" Advertise="yes">
        <Extension Id="sps" Advertise="yes">
          <MIME ContentType="application/sps" Default="yes" />
          <Verb Id="open" Command="&amp;Open" Argument="&quot;%1&quot;" Sequence="1" />
        </Extension>
      </ProgId> 
    </Component>
    <Component Id="DesktopShortcut" Guid="60F4A4B3-DD4D-4FD6-B6AE-9C5EB8FCC0D1" Directory="DesktopFolder" Condition="CREATE_DESKTOP_ICON">
      <RegistryValue Root="HKCU" Key="SOFTWARE\TechGroup\SAMPLE_9" Name="DesktopShortcutEnabled" Value="1"></RegistryValue>
      <Shortcut Name="SAMPLE_9" Directory="DesktopFolder" Target="[#filSample]" Icon="Sample.exe"></Shortcut>
    </Component>
    <Component Id="MenuShortcut" Guid="771174C2-CAC8-4E32-9BC6-C91D5458C9FA" Directory="ProgramMenuFolder" Condition="CREATE_MENU_ITEMS">
      <RegistryValue Root="HKCU" Key="SOFTWARE\TechGroup\SAMPLE_9" Name="MenuShortcutEnabled" Value="1"></RegistryValue>
      <Shortcut Name="SAMPLE_9" Directory="ProgramMenuFolder" Target="[#filSample]" Icon="Sample.exe"></Shortcut>
    </Component>
  </xsl:template>  
  <xsl:template match="wix:ComponentRef[key('sampleExe-search', @Id)]" >
    <ComponentRef Id="cmpSample" />
    <ComponentRef Id="DesktopShortcut" />
    <ComponentRef Id="MenuShortcut" />
  </xsl:template>
  
  <!--Override SAMPLE.exe.cofig component-->
  <xsl:key name="sampleExeConfig-search" match="wix:Component[wix:File/@Source='$(var.BasePath)\SAMPLE.exe.config']" use="@Id" />
  <xsl:template match="wix:Component[key('sampleExeConfig-search', @Id)]" >
    <Component Id="cmpSampleConfig" Guid="{@Guid}">
      <File Id="filSampleConfig" Source="$(var.BasePath)\SAMPLE.exe.config" />
    </Component>     
  </xsl:template>    
  <xsl:template match="wix:ComponentRef[key('sampleExeConfig-search', @Id)]" >
    <ComponentRef Id="cmpSampleConfig" />  
  </xsl:template>

</xsl:stylesheet>

Solution

  • The transforms are still necessary, as the upgrade to v4 did not change or obsolete their functionality.

    Transforms are super useful for modifying the heat harvest output without touching the directory structure itself. Anything they did in v3 will still be needed in v4.

    If you want to remove it and keep the same end result, you will likely need to modify the folders/files in SposOnboard.Application\bin$(Configuration) to have what you need with no transformation. You can get more specific advice on what that could look like if you show us the transform file.