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]: MSI Build Numbers[Next]: Enable Platform Definition Creation
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Source Code->Configuration / Options->Processing Mode - Developer or Production Build?

Processing Mode - Developer or Production Build?

The "MMMODE" macro allows you to determine whether you are in "Developer", "Production" or even some user defined mode. The mode is generally passed as a parameter on the "PPWIZARD" command line used to invoke the build. The value is validated by the header "MMMODE.MMH", see it for more details.

The processing mode is more for your use than MAKEMSI's (it is used to set default compression level) and allows you to vary your processing depending on the mode being used (perhaps adding debug code in "development mode").

EXAMPLE 1

A frequent use of the mode is to configure options differently between production and development builds. I like the following approach where the conditional processing is "hidden" (note that the "MMMODE" macro contains "D" or "P"):

;--- What should be the default "PAUSE" parameter value? ---
#define?  DEFAULT_DEBUG_PAUSE.D  Y   ;;Default to PAUSE=Y in dev
#define?  DEFAULT_DEBUG_PAUSE.P  N   ;;Default to PAUSE=N in prod

;--- Load MAKEMSI (via wrapper) ---
#define?  SUNDRY_CA_PAUSE  <$DEFAULT_DEBUG_PAUSE.[MMMODE]>
#include "DEPT.MMH"
...

In the above I used "#define?" for all 3 definitions allowing the values to be overriden at both levels if required, the user has two main choices:

  1. Supply a value for the "SUNDRY_CA_PAUSE" macro.

  2. Supply values for "DEFAULT_DEBUG_PAUSE.D" and/or "DEFAULT_DEBUG_PAUSE.P".

EXAMPLE 2

The follow was extracted from a custom action where in development mode I'd like to have certain information logged but I don't want this done in production. Of course I could have added some sort of runtime environment checking but here I'm simply using the mode the MSI has been built under:

;--- Show userId and password in custom action ----------------------
#if ['<$MmMode>' <> '<$MMMODE_PRODUCTION>']
   ;--- Not production so show USERID and PASSWORD ------------------
   #ifndef COMPLUS_NEVER_LOG_USERID
       CaDebug 0, "USERID  : """ & AppUserId & """"
   #endif
   #ifndef COMPLUS_NEVER_LOG_PASSWORD
       CaDebug 0, "PASSWORD: """ & AppPw & """"
   #endif
#endif

EXAMPLE 3

The following is a fragment which only shows a schedule being created. It is slightly different in development to make testing it easier and faster.

<$Schedule "<$ProdInfo.ProductName>-RebootsWorkstation" DATA="CadREBOOT" JT.EXE="[INSTALLDIR]MS_jt.exe" Condition="<$COND_REBOOT_ALLOWED>">
   ;--- Set up task details -------------------------------------------------
   /SJ
   WorkingDirectory = "(*INSTALLDIR*)"
   ApplicationName  = "%COMSPEC%"
   Parameters = "/C <$REBOOT.CMD_BASENAME>"
   Interactive = 1
   Comment = "Runs on all boxes BUT only reboots workstations (any logged on user can cancel)."
   Creator = "<$ProdInfo.ProductName> version <$ProductVersion> (via schedule Macro)"
   MaxRunTime = 7200000                    ;;1 hour (in milliseconds)
   KillIfGoingOnBatteries = 0
   SystemRequired = 1

   ;--- Create a trigger ----------------------------------------------------
   /CTJ
   Type = Weekly
   #if ['<$MmMode>' = '<$MMMODE_DEVELOPMENT>']
       ;--- DEVELOPMENT: Every Night ----------------------------------------
       #info ^DEVELOPMENT MODE: SCHEDULE REBOOTS Every Night^
       TypeArguments = 1,UMTWRFA
   #else
       ;--- PRODUCTION: Sunday, Friday and Saturday -------------------------
       #info ^PRODUCTION MODE: SCHEDULE REBOOTS Friday, Saturday & Sunday!^
       TypeArguments = 1,U....FA
   #endif
   EndDate = 00/00/0000
   StartTime = 23:15                ;;Around midnight
   MinutesDuration=60
   KillAtDuration=1
   Disabled = 0

   ;--- Set the Security Info -----------------------------------------------
   /SC "" NULL
<$/Schedule>


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]: MSI Build Numbers[Next]: Enable Platform Definition Creation


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday December 09 2017 at 9:30am
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.