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]: Windows 2000 or Greater?[Next]: Overriding & Remembering the Installation Directory
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Tips and Tricks->Launch Conditions->Z: Available?

Launch Condition: Z: Available?

If your msi needs to access a specific drive (Z: in this case), then the simplest way of displaying a suitable error message is to customise the default error message that Windows Installer will display (for the error 1327) to be more user-friendly:

;--- Machine must have a Z: ---
<$Table "Error">
   <$Row Error="1327" Message=^Drive "[2]" does not exist. This is required to install this product.^>
<$/Table>

Overriding from Command Line

If required you should be able to override the appropriate directory key from the "MSIEXEC.EXE" command line. If you used the "DirectoryTree" command to define a directory "off the root" like this:

<$DirectoryTree Key="INSTALLDIR" Dir="K:\SomeSubDir" CHANGE="\" PrimaryFolder="Y">

Then the name of the root drive/directory is contained in a public property named with the value of the macro "DIRTREE_DRIVE_PROPERTY_PREFIX" followed by the drive letter, with the default value this would be "DRIVE.K" for the above definition.

msiexec.exe /i SomeMsi.msi /l*v SomeLog.txt DRIVE.K="S:\">

Use Actions to Verify or Alter Directory

You can use a custom action to see if the drive exists and take appropriate action (display an error message or default to another location before Windows Installer validates it).

This demonstrates one way the value can be overriden (could be reading an environment variable's value and could be conditionally executed):

#(
    <$PropertyCa
                "<$DIRTREE_DRIVE_PROPERTY_PREFIX>K"                       ;;Update the root key
          Value="c:\TMP\AAAA\"                                            ;;This is the new "root" (any directory name)
            Seq="1-" SeqTable=^InstallUISequence InstallExecuteSequence^  ;;Do this before Windows Installer validates the value
    >
#)


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]: Windows 2000 or Greater?[Next]: Overriding & Remembering the Installation Directory


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday May 28 2022 at 3:11pm
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.