MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Version File Based Launch Conditions[Next]: Zip Source and Add to MSI
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Source Code->Configuration / Options->XML Version File

XML Version File

I will need to update this section but the basic idea is that if you want to enter version information in XML then probably the simplest way is to use a stylesheet to generate a "normal" version file.

A command such as the following can be used to generate the version file from it's XML format:

msxsl.exe  version.xml  xml2ver.xsl > version.ver

The "msxsl.exe" program actually produces unicode output which MAKEMSI won't like, you can convert the output using the "TYPE" command and redirecting the output.

The "MAKEMSI_HOOK_JUST_BEFORE_VERSION_FILE_PROCESSING_STARTS" hook can be used to define your processing:

#(  ''
    #define MAKEMSI_HOOK_JUST_BEFORE_VERSION_FILE_PROCESSING_STARTS

    ;--- Conversion code here... --------------------------------------------
#)

VERSION.XML

This is some sample XML:

<?xml version="1.0" encoding="utf-8"?>
<MAKEMSI>
   <ProductInformation>
        <Name>Fred</Name>
        <Version>1.2.3.4</Version>
        <Comments>
            This is a shjdh dsjh jkfsdhjf hkjf hdsjh fsjh fjkh fjk
            hsdjkfhds fd
            2nd line jklfdjlk sdlkjfkldsjf klsdjlkfj dsl
            3rd line hdjhdkjhdjkdhjkdhhdjkhdjk
        </Comments>
        <SomeAsYetUnknownKeyword>NeedsIteration required on "ProductInformation"</SomeAsYetUnknownKeyword>
   </ProductInformation>


   <Changes>
        <Change>
            <Version>4.3.2.1</Version>
            <Date>1 Feb 2005</Date>
            <Desc>The changes for the current release.</Desc>
        </Change>

        <Change>
            <Version>4.3.2.0</Version>
            <Date>1 Jan 2005</Date>
            <Desc>The changes text.</Desc>
        </Change>
   </Changes>
</MAKEMSI>

XML2VER.XSL

This is one possible form of a stylesheet:

<?xml version="1.0"?>
<!--
          Thanks to Mike Blake-Knox for producing the original basic code.
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <!-- text (non-XML output) -->
 <xsl:output method="text"/>

 <!-- template that matches whole document -->
 <xsl:template match="MAKEMSI">

<!-- Output a header comment -->
<xsl:text>;=====================================================
;======== Automatically Generated file ===============
;=====================================================
;=== FROM :
;=== DATED: ?
;=====================================================

&#xA;
;##################[Product Information Section of the ".VER" file]############

</xsl:text>

    <!-- Work though all sub nodes of "ProductInformation" -->
    <xsl:for-each select="ProductInformation">
          <xsl:for-each select="*">
              <!-- Start a new line -->
              <xsl:text>&#xA;</xsl:text>

              <!-- Output KEYWORD name -->
              <xsl:value-of select="name()"/>

              <!-- "=" -->
              <xsl:text> = </xsl:text>

              <!-- Output KEYWORD value (convert newlines to spaces) -->
              <xsl:value-of select="normalize-space( translate(current(), '&#xA;', ' '))"/>
          </xsl:for-each>
  </xsl:for-each>

  <!-- A few new lines -->
  <xsl:text>&#xA;&#xA;&#xA;</xsl:text>

  <!-- For each change history item -->
  <xsl:for-each select="Changes">
      <xsl:for-each select="Change">
<xsl:text>
&#xA;
;##################[Change]####################################################
</xsl:text>
          <xsl:for-each select="*">
              <!-- Start a new line -->
              <xsl:text>&#xA;</xsl:text>

              <!-- Output KEYWORD (convert "Desc" to "Comments") -->
              <xsl:choose>
                   <xsl:when test="name() = &quot;Desc&quot;">
                        <!-- Output "COMMENTS" as keyword -->
                        <xsl:text>Comments</xsl:text>
                   </xsl:when>
                   <xsl:otherwise>
                        <!-- Output original KEYWORD -->
                        <xsl:value-of select="name()"/>
                   </xsl:otherwise>
              </xsl:choose>

              <!-- Output ":" -->
              <xsl:text> : </xsl:text>

              <!-- Output the value -->
              <xsl:value-of select="current()"/>
          </xsl:for-each>
      </xsl:for-each>
  </xsl:for-each>

  <!-- A few new lines -->
  <xsl:text>&#xA;&#xA;&#xA;</xsl:text>
 </xsl:template>
</xsl:stylesheet>


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Version File Based Launch Conditions[Next]: Zip Source and Add to MSI


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday August 13 2017 at 2:39pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.