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]: ComPlusComp[Next]: /ComPlusCompUpdate
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Source Code->Commands->ComPlusCompUpdate

The "ComPlusCompUpdate" Command

This command must be used within a ComPlusApp block.

The command is used to indicate which already existing component(s) (created with the "ComPlusComp" command) should be updated.

Between this command and the matching "/ComPlusCompUpdate" command you will use one or more "ComPlusProperty" commands to set the component properties. You can also place VBSCRIPT to operate on the component if you wish. The whole block is within a VB 'with' statement so you can operate on the component without knowing its name. Your code can use any of the following functions:

  1. VbsCaCadGet
  2. VbsCaCadGetValidate
  3. VbsCaCadReplace
  4. CaDebug
  5. CaDebugPause
  6. CaGetEnv
  7. CaMsgBox
  8. VbsCaPropertyGet
  9. VbsCaRaiseError

This command takes these parameters to select which components are being updated:

If neither "ProgID" or "Where" parameters are passed then you wish all components updated.

EXAMPLE

This example shows an application being created. MAKEMSI is choosing the ID (a guid) and it will use the same one for any subsequent build. Both Application and component properties are being set.

;--- Include MAKEMSI --------------------------------------------------------
#include "ME.MMH"

;--- Define installation directory (INSTALLDIR) -----------------------------
<$DirectoryTree Key="INSTALLDIR" Dir="[ProgramFilesFolder]\SomeDirectory" CHANGE="\" PrimaryFolder="Y">

;--- I'm using any handy DLLs for this sample (I don't expect it to work...) ---
#define FILE_SRC_DIR       C:\Program Files\makemsi
#define SAMPLE_COM+DLL_#1  MakeMSI.DLL
#define SAMPLE_COM+DLL_#2  Reg4mm.dll

;--- Add the files (MSI components auto-generated) --------------------------
<$File RowKey="<$SAMPLE_COM+DLL_#1>" SOURCE="<$FILE_SRC_DIR>\<$SAMPLE_COM+DLL_#1>" Destination="[INSTALLDIR]\<$SAMPLE_COM+DLL_#1>">
<$File RowKey="<$SAMPLE_COM+DLL_#2>" SOURCE="<$FILE_SRC_DIR>\<$SAMPLE_COM+DLL_#2>" Destination="[INSTALLDIR]\<$SAMPLE_COM+DLL_#2>">

;--- Create properties for USERID/PASSWORD (could create dialog to ask user) ---
<$Property "USERID"   Value="Fred">   ;;Can override on command line if wanted
<$Property "PASSWORD" Value="abc">    ;;Can override on command line if wanted

;--- Define the COM+ Application --------------------------------------------
#data 'CaData' 2
    ;--- Pass installation directory and install time DLL names -------------
    "INSTALLDIR"        "[INSTALLDIR]"                ;;Location of installation directory
    "COMPLUS_DLL_1"     "[#<$SAMPLE_COM+DLL_#1>]"     ;;Want full install time location of specified file "RowKey"
    "COMPLUS_DLL_2"     "[#<$SAMPLE_COM+DLL_#2>]"

    ;--- Pass UserId and Password -------------------------------------------
    "USERID"            "[USERID]"
    "PASSWORD"          "[PASSWORD]"
#data
#(
<$ComPlusApp
   "DennisBareisTest"
       DELETE="Y"
         Data="CaData"
         User=^VbsCaCadGet("USERID")^ PassWord=^VbsCaCadGet("PASSWORD")^
;        User=^"Dennis"^ PassWord=^"abc"^
;          ID="{47819B72-386A-4400-830C-1D0172EBF456}"
>
#)
   ;--- Set some Application attributes -------------------------------------
   <$ComPlusProperty "Description"                     VALUE=^"Test Application created by TestMsi.MM"^>
   <$ComPlusProperty "AccessChecksLevel"               VALUE="COMAdminAccessChecksApplicationComponentLevel">
   <$ComPlusProperty "ApplicationAccessChecksEnabled"  VALUE="True">

   ;--- Create some application ROLES ---------------------------------------
   <$ComPlusRole "DennisBareisTestUsers" Description="Users for the DennisBareisTest test application" USERS="Everyone;Dennis">

   ;--- Add components (note that a single DLL can have more than 1 component!) -------------------------
   <$ComPlusComp DLL=^(*COMPLUS_DLL_1*)^>       ;;Filenames passed in Custom Action data (correct no matter where user installed them)
   <$ComPlusComp DLL=^(*COMPLUS_DLL_2*)^>

   ;--- Update the component(s) ---------------------------------------------
   <$ComPlusCompUpdate>          ;;Update all components (PROGID not supplied)
       ;--- Assign ROLES to the COMPONENT -----------------------------------
       <$ComPlusRole "DennisBareisTestUsers">
       <$ComPlusProperty "ComponentAccessChecksEnabled"  VALUE="True">
   <$/ComPlusCompUpdate>

   ;--- Try some exporting --------------------------------------------------
   <$ComPlusExport MSI="out\ExportedCom-App.msi"   PROXY="N">
   <$ComPlusExport MSI="out\ExportedCom-Proxy.msi" PROXY="Y">
<$/ComPlusApp>


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]: ComPlusComp[Next]: /ComPlusCompUpdate


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Friday October 13 2017 at 2:08pm
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.