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]: Patches and Non-Major Updates can be dangerous![Next]: Don't change or place files into MAKEMSI Directories
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Best Practices->File Source Locations

BEST PRACTICE: File Source Locations

Often you may have a separate directory tree containing an image of the files you wish to include in the MSI (another approach is to pack them into a zip file).

I recommend that if possible you define a network location (possibly share) which will the root of all source images and that you refer to this location via an environment variable such as "MsiFileImages". This environment variable can be defined via "My Computer" properties ("Advanced" tab). A (possibly better) way of defining the sources root is via a macro defined in a common header file that all MSI projects will include.

There are two main approaches to how the images could be maintained as follows:

  1. The "current" files tree is always in the same location. Previous versions may either be overwritten or the image directory may have been renamed to "old" etc.

  2. Each each version has its own tree. For this approach I recommend storing images under the MSI product names and versions (full or partial version).

    An example that uses the full version number:

    ;--- Define where the source image is ---------------------------------------
    #define ImageRootDirectory <??*MsiFileImages>\<$ProdInfo.ProductName>\<$ProductVersion>
    
    ;--- Load all files ---------------------------------------------------------
    <$Files '<$ImageRootDirectory>\*.*' SubDir='TREE' DestDir='INSTALLDIR'>

    An example that uses the major and minor parts of the version number only:

    ;--- Extract Major & Minor parts from the version number --------------------
    #evaluate ^^ ^parse value '<$ProductVersion>' with VerMaj '.' VerMin '.'^
    
    ;--- Define where the source image is ---------------------------------------
    #define ImageRootDirectory <??*MsiFileImages>\<$ProdInfo.ProductName>\<??VerMaj>.<??VerMin>
    ;#define ImageRootDirectory <??*MsiFileImages>\<$ProdInfo.ProductName>\<??VerMaj>\<??VerMin>
    
    ;--- Load all files ---------------------------------------------------------
    <$Files '<$ImageRootDirectory>\*.*' SubDir='TREE' DestDir='INSTALLDIR'>

Which of the above approaches is the best depends on how many files and sub directories there are, how the image is produced and who is producing the changes (how much control do you have).

Note that these approaches make it possible to create scripts which don't vary from release to release.


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]: Patches and Non-Major Updates can be dangerous![Next]: Don't change or place files into MAKEMSI Directories


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday February 28 2016 at 3:45pm
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.