View Full Version : Why is MAINTENANCE ALWAYS set to False??

07-29-2002, 03:50 AM

I've posted here a few times and I still can't find out the reason why MAINTENANCE is ALWAYS set to FALSE.

The code I am trying to execute is:

function OnEnd()
if (!MAINTENANCE) then
//install stuff, attach database, etc....

It's a major problem because things are trying to install when I'm actually uninstalling... etc...

Anyone have any ideas??


Any help is really appreciated!

P.S. Time is REALLY short, so I kinda need help pretty quickly. If you could reply asap that'd be excellent :(

07-29-2002, 08:04 AM
Let me know whether you were launching the setup second time or first time. During first time launch, MAINTENANCE would be FALSE. Debug your project and then check the events which your project follows. If possible, attach your project file(ism).

07-29-2002, 05:47 PM
It's FALSE everytime, even on an uninstall or a second launch of the setup, which is why I am having so much trouble :(

Don't think its possible to post the .ism file - invalid file extension.

I'm all out of ideas :(

07-30-2002, 11:14 AM
i can confirm this behaviour for IS dev 7.04 using a basic MSI project. The "OnEnd()" event handler is executed, but the MAINTENANCE "system variable" (as it is referred to in the docs) is always set to FALSE. more precisely: it's not set at all!

this piece of info is from the docs:

The code in the OnEnd event handler is always executed, even during a maintenance setup or uninstallation, unless you place it inside the following if-then structure:
if (!MAINTENANCE) then
// non-maintenance code

so, as sherlock would say: either the docs are erroneous or the software is....

at least i found a quick and dirty workaround (which won't please everybody):
in basic MSI projects you can detect the installation type via "conditions":
- you'll have to call the IS functions via "custom actions"
- integrate those custom actions into the sequences
- in the "custom action view" set "conditions" for each sequence
(you won't be able to check these conditions from within installscript, though)
these are the different conditions you may assign:

In the Windows Installer sequences, the following conditions detect certain types of installation:

- First-time installation: "Not Installed"
- Maintenance: "Installed"
- Uninstallation: REMOVE="ALL" (after the InstallValidate action)

but why is MAINTENANCE not set by installshield? sounds like a bug. some official statements would be nice....
unfortunately, this issue is NOT covered in the brand new Q106616 as of 2002/08/08.

cheers, graven

07-30-2002, 06:47 PM
Thanks alot graven!! I implemented a work-around using the info you gave me and it seems to have fixed the problem.

I guess it's kinda nice to know that I'm not the only one experiencing problems with !MAINTENANCE, and also to know that there is a work-around for the problem.

Perhaps the MAINTENANCE bug is only related to MSI projects? It's only a guess - I really have no idea. Do you happen to know if Installshield knows about this problem?

07-30-2002, 06:50 PM
Gumby22, did you try my suggestion (http://community.installshield.com/showthread.php?s=&threadid=99418)? Does it work?

Can you send me the code in OnEnd function? I will forward it to our developers, and have them take a look.

07-30-2002, 09:54 PM
Sorry TsungH, I was busy trying other stuff (like trying to setup a shared directory on Windows9x platforms! Do you know anyone who might know how to do it through InstallShield??) :)

Yeah mate I created a Custom Action which calls a Function in the InstallScript and sets a variable which is used in the OnEnd() function, to determine a First time install or not, and the suggestion works fine.

Would you prefer me to post the code here in plain text, or in a text file ??

07-31-2002, 05:24 PM
You can upload a text file here. Or if you prefer, you can send me a private message.