![]() |
|
![]() |
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:
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.
![]() ![]() |
| ![]() ![]() |