all groups > dotnet setup > september 2004 >
You're in the

dotnet setup

group:

Installer.OnBeforeInstall method firing after installation?


Re: Installer.OnBeforeInstall method firing after installation? Phil Wilson
9/16/2004 9:21:41 AM
dotnet setup:
Unfortunately "OnBeforeInstall" means before calling the Install method in
the custom action, not before the entire install. I think it's actually
called out of the Install method before it does anything. All Visual Studio
custom actions are called pretty much after everything has been copied to
the system and installed so that your files, registration etc are in place
for your code to work. The install is actually closer to the completion than
the start. (InstallShield, Wise, ActiveInstall, ZeroG etcare in the business
of tools that let you take advanatage of more of what MSI can do, including
custom actions and user-defined dialogs in the initial UI sequence. See
http://www.installsite.org/pages/en/msi/authoring.htm )

You could think about doing a Search Target Machine for MSDE (because that
takes place early in the install) and that would set a property, then you
could add a VS checkboxes dialog, and use another property from that
checkbox as a condition on the feature you want to install (I don't think
you mean literally feature because there is only one feature in VS setups,
DefaultFeature). The cancel would then take place in the UI before any of
your code even runs, and you wouldn't even need an Installer class. The
Checkboxes dialog has a Cancel button on it already, that might be much more
convenient.
--
Phil Wilson
[MVP Windows Installer]
Definitive Guide to Windows Installer
http://www.amazon.com/exec/obidos/tg/detail/-/1590592972/104-7044380-4696760

[quoted text, click to view]

Installer.OnBeforeInstall method firing after installation? Michael Hoehne
9/16/2004 1:45:23 PM
Hi, hope this is the correct newsgroup for this question. If not, please
point me to a better one.

I have created a custom installer action that I use in my Visual Studio
Setup and deployment project. When called, it checks for the existence of
MSDE 2000. If MSDE is found, the user should be prompted if he wants to
continue with the installation or not. When he chooses to continue, the
application will be installed but some features will be disabled. If he
chooses not to install, the installation should be canceled.

The check for MSDE is done in the OnBeforeInstall method of the custom
action. I expected that this method is called "before" any installation
actions are done. I understand that in order to run my custom action, the
installer needs to unpack the dependent files, but what really happens is
the following:

The installer displays the welcome screen, prompts for the installation
folder and copies "all" files from the msi package to the installation
folder. I'm not sure if it also registers components, but that would not be
an issue, if I can hook into the installer, before the files are copied. I
want to let the user decide if he wants to install before the installation
starts. Is this possible?

The second question is about signaling that the user wants to cancel the
installation. Right now I'm throwing an InstallException. While this will
lead to a rollback, I get two error messages that I would like to suppress
or customize. The first displays the message "An exception occurred in the
OnBeforeInstall event handler of <assemblyname>. -> <message>", where
assemblyname is the name of my custom action and message is the message text
I used when throwing the InstallException. After clicking Ok, a second
message box is displayed, saying "An exception occurred during the Rollback
phase of the installation. ... -> The savedState dictionary does not contain
the expected values and might have been corrupted". After pressing Ok again,
the installation is rolled back.

Is there a better way to cancel the installation than throwing an
InstallException?


Thanks for your help!

Michael




Re: Installer.OnBeforeInstall method firing after installation? Michael Höhne
9/17/2004 8:57:23 PM
Phil,

[quoted text, click to view]
custom actions for it as well, so I expected the MSI custom actions to work
the same.
I will see if I can do a search for MSDE with the Search Target Machine
approach. As far as I can see I will end up using a different installer in
the future, but for now it may be sufficient to go with MSI again.

Thanks
Michael

"Phil Wilson" <pdjwilson@nospam.cox.net> schrieb im Newsbeitrag
news:enrJpjAnEHA.2372@TK2MSFTNGP10.phx.gbl...
[quoted text, click to view]

Re: Installer.OnBeforeInstall method firing after installation? Stefan Krueger [MVP]
9/19/2004 9:50:43 AM
ActiveInstall is now Zero G InstallAnywhere .NET (they have acquired
ActiveInstall end of last year)

--
Stefan Krueger
Microsoft Windows Installer MVP

Please post your questions in the newsgroup or vist one of these web sites:

Windows Installer FAQ
http://www.msifaq.com - http://www.msifaq.de

InstallSite - Resources for Setup Developers
http://www.installsite.org
http://www.installsite.de (GERMAN)


"Michael Höhne" <mhoehne@mhsw.de> schrieb im Newsbeitrag
news:Od0I8gOnEHA.2216@TK2MSFTNGP10.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button