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]: Testing Under the Local System Account[Next]: URL Shortcuts
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Tips and Tricks->No Installation Registration

No Installation Registration

At times you may wish to simply have something happen during installation that requires no uninstallation. While in general I don't think this is a good idea I am documentating how it can be done here.

This makes the MSI much more like a batch file or install script but much more powerful and still supporting commit and rollback!

EXAMPLE: NEVER REGISTER

The following is a macro containing the logic (this could be centralised in a header file):

#(  ''
    #define NoInstallationRegistration          ;;Version 06.344

    <$Table "InstallExecuteSequence">
       <$RowsDelete WHERE="Action = 'PublishComponents'">
       <$RowsDelete WHERE="Action = 'PublishFeatures'">
       <$RowsDelete WHERE="Action = 'PublishProduct'">
       <$RowsDelete WHERE="Action = 'RegisterProduct'">
       <$RowsDelete WHERE="Action = 'RegisterUser'">
    <$/Table>
    <$MsiValFilter "ICE82">
#)

Now to use the above macro:

<$NoInstallationRegistration>

An error is not generated if any of the actions didn't exist for any reason. (for example if you accidently executed it twice).

Of course if you have code which references any of the above actions (for example when sequencing other custom actions) then you'd need to adjust it...

EXAMPLE: SOMETIMES DON'T REGISTER

Sometime there might be situations where you want registration and others where you won't, an example is a package which installs on "normal" desktop workstations and well as stateless Wyse thin clients.

The following code allows you to state under which circumstances you wish to allow or prevent the normal installation registration from occuring. It also allows for individual control over each of the 5 registration items (you may never need it, but if you do...).

You can override the condition, by default the code below defines a system environment variable and MSI property which if it exists (with any value) prevents the registration:

;--- Define the conditions for registration ---------------------------------
#define? OptRegist_DISABLES_INSTALL_REGISTRATION  NO_MSI_REGISTRATION
#(
    ;--- Blank means don't touch! 1 = always etc. ---------------------------
    #define? OptRegist_REGISTRATION_CONDITION

    (%<$OptRegist_DISABLES_INSTALL_REGISTRATION> = "")   ;;Environment variable doesn't exist
    AND
    (not <$OptRegist_DISABLES_INSTALL_REGISTRATION>)     ;;property doesn't exist
#)
#(  ' '
    #define @@SetRegistrationCondition                   ;;Version 06.344

    ;--- Allow user to have control over each item... (empty to disable) ----
    #define? OptRegist_REGISTRATION_CONDITION_FOR_{$#1} <$OptRegist_REGISTRATION_CONDITION>  ;;Default to global condition if user didn't suuply one for this item.

    ;--- Now take appropriate action ----------------------------------------
    #if ["<$OptRegist_REGISTRATION_CONDITION_FOR_{$#1} $$IsBlank>" = "N"]
        ;--- Update hasn't been disabled by MSI author ----------------------
        <$Table "InstallExecuteSequence">
            <$Row
                  @Where="`Action` = '{$#1}'"
                     @OK='=1'
               Condition=`<$OptRegist_REGISTRATION_CONDITION_FOR_{$#1}>`
            >
       <$/Table>
    #endif
#)

;--- Now perform the registration changes -----------------------------------
<$@@SetRegistrationCondition 'PublishComponents'>
<$@@SetRegistrationCondition 'PublishFeatures'>
<$@@SetRegistrationCondition 'PublishProduct'>
<$@@SetRegistrationCondition 'RegisterProduct'>
<$@@SetRegistrationCondition 'RegisterUser'>


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]: Testing Under the Local System Account[Next]: URL Shortcuts


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.