MSI install sequence - run DB scripts before services start
Posted
by marc_s
on Stack Overflow
See other posts from Stack Overflow
or by marc_s
Published on 2009-03-25T20:45:02Z
Indexed on
2010/04/22
18:43 UTC
Read the original article
Hit count: 232
Folks,
we're running into some sequencing troubles with our MSI install. As part of our app, we install a bunch of services and allow the user to pick whether to start them right away or later.
When they start right away, they seem to start too early in the install sequence - before our database manager had a chance to update the database.
Right now, our custom action to run the database updater looks like this - it's being run after "InstallFinalize" - very late in the process.
<InstallExecuteSequence>
<RemoveExistingProducts After='InstallInitialize' />
<Custom Action='RunDbUpdateManagerAction' After='InstallFinalize'>
DbUpdateManager=3</Custom>
</InstallExecuteSequence>
What would be the more appropriate step to run after or before, to make sure the DB scripts are executed before any of the installed services start up? Is there a "BeforeServiceStart" step?
EDIT:
Just defining the "Before='StartServices'" attribute on the tag didn't solve my problem.
I am assuming the issue is this: the custom action has an "inner text", which represents a condition, and this condition is: "&DbUpdateManager=3". From what I can deduce from trial & error, this probably means "the DbUpdateManager feature must be published".
Now, trouble is: "PublishFeature" comes way at the end in the install sequence, just before "InstallFinalize", and definitely AFTER InstallServices / StartServices. So when I specify the "Before=StartServices" requirement, the condition "DbUpdateManager feature must be published" isn't true yet, so the DbUpdateManager doesn't get executed :-(
I tried removing the condition - in that case, my DbUpdateManager sometimes doesn't execute at all, sometimes more than once - no real clear pattern as to what happens when.....
Any more ideas?? Is there a way I could check for a condition "the DbUpdateManager feature is installed" which would be true after the "InstallFiles" step??
Marc
© Stack Overflow or respective owner