General question concerning the single 'Apply Install'.

Got a problem you cannot solve? Try here.
Post Reply
albel
Posts: 20
Joined: Thu Jun 11, 2009 3:45 pm

General question concerning the single 'Apply Install'.

Post by albel »

Hi,

I have a question relating to install procedures. I guess it is a general question concerning whether the 'Apply Install' statement has to be treated in an all-or-nothing way, or can an install happen in steps.
First the description of an example installer for discussion.
The installer installs files to a subdirectory, installs an NT service that uses one of those files, and modifies a config file so the service works correctly. The first two parts depend on a single 'Apply Install' statement. The trouble is that if something goes wrong with installation of the service, which is the more error-prone action, the whole install fails, no files are copied either. The LastError variable has only "Installation failed" in it. This installer is doing only 2 things so it is possible to work around the rather weak error message and deduce where the problem lies, but in a more complicated installer containing many install-level statements a single Apply Install could be a mystery if one thing doesn't install right. In the example above is it possible to do these two install actions separately, or in stages in the same installation, yet when everything goes well, they are both undone at the same time when uninstalling the product?

Thanks in advance.
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

Using logging will always help pinpoint the error.

As for Apply Install, call it twice :) The purple actions executed until then will "apply", and they won't be undone in further calls to Apply Install, which will apply more purple commands executed since.

Apply Uninstall will undo everything in one call; if you would like to uninstall after preceding Apply Install's succeed and a latter one fails, just call Apply Uninstall to leave the system clean.

For full details on the tricks of using Apply Changes (and the caveats), refer to the MSIcode Scripting whitepaper, on the publications section of our main website.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
albel
Posts: 20
Joined: Thu Jun 11, 2009 3:45 pm

Re: General question concerning the single 'Apply Install'.

Post by albel »

Thanks Michael,

I'll refer to that whitepaper.
The logging definately helped in picking through the problems during development, but I couldn't really use that in reporting problems to a user in the field.

If, as you described, I can use multiple Apply Install statements, the success/failure of each will help to identify to the user which step of the install has a problem.

I'd like to make one request; can the LastError variable get a little more descriptive?
Or, an alternative is to treat it like your team did with how the SQL Server plug-in returns error messages. I like how they did that. It lets me get as detailed an error message as I need, depending on the situation.
These are just some suggestions.

Thanks again.
Post Reply