MSI Sequencing...... techie question!
I want to pragmatically insert 2 custom actions in the installation sequence. Simple enough.
Action 1. Custom Action to retrieve Properties or System data, and store it for use in the Deferred Execute sequence.
Action 2. Utilise the data captured in Action 1 in the Deferred Execute sequence.
Part One is simple....
Action 1. will be achieved using either the AppSearch Action or by placing a user-defined CustomAction after the AppSearch Action (by identifying the AppSearch Sequence number as part of the script).
Here's the thing..... Action 2.
How do you identify the sequence number of the 'InstallFinalize' action in the 'Execute Deferred' sequence (using the sequence numbers or otherwise). In other words how do you identify where the 'Execute Immediate' sequence stops and 'Execute Deferred' sequence starts??
Once I can identify the sequence number of the 'InstallFinalize' action in the 'Execute Deferred' sequence, I can either increment or decrement this number to place my CustomAction before or after 'InstallFinalize' action in the 'Execute Deferred' sequence.
When you use Wise to view the msi, you can see both sequences and the only thing I can see to identify the difference is the sequence numbers.
I apologise in advance if this sounds over complicated. I've had a quick look at John McFadyen blog which explains that 'InstallFinalize' in the 'Execute Immediate' sequence actually triggers the 'Execute Deferred' sequence but there is only one 'InstallFinalize' entry in the InstallExecuteSequence table....! How else can you identify the diffent sequences??
This may be a difficult question to answer I think [>:].
I'm sure if I've not explained anything clearly enough, you'll come back with questions.!
Cheers
Simon.
Action 1. Custom Action to retrieve Properties or System data, and store it for use in the Deferred Execute sequence.
Action 2. Utilise the data captured in Action 1 in the Deferred Execute sequence.
Part One is simple....
Action 1. will be achieved using either the AppSearch Action or by placing a user-defined CustomAction after the AppSearch Action (by identifying the AppSearch Sequence number as part of the script).
Here's the thing..... Action 2.
How do you identify the sequence number of the 'InstallFinalize' action in the 'Execute Deferred' sequence (using the sequence numbers or otherwise). In other words how do you identify where the 'Execute Immediate' sequence stops and 'Execute Deferred' sequence starts??
Once I can identify the sequence number of the 'InstallFinalize' action in the 'Execute Deferred' sequence, I can either increment or decrement this number to place my CustomAction before or after 'InstallFinalize' action in the 'Execute Deferred' sequence.
When you use Wise to view the msi, you can see both sequences and the only thing I can see to identify the difference is the sequence numbers.
I apologise in advance if this sounds over complicated. I've had a quick look at John McFadyen blog which explains that 'InstallFinalize' in the 'Execute Immediate' sequence actually triggers the 'Execute Deferred' sequence but there is only one 'InstallFinalize' entry in the InstallExecuteSequence table....! How else can you identify the diffent sequences??
This may be a difficult question to answer I think [>:].
I'm sure if I've not explained anything clearly enough, you'll come back with questions.!
Cheers
Simon.
0 Comments
[ + ] Show comments
Answers (12)
Please log in to answer
Posted by:
jmcfadyen
16 years ago
Simon you are quite correct.
have a read of this ..
http://johnmcfadyen.spaces.live.com/blog/cns!9DD01136FC094724!167.entry
in relation to what you are doing if you using Wise Macro's to do this you can do something along the lines of this
set tblInstallExecuteSequence = WTables("InstallExecuteSequence")
set rowInstallExecute = tblInstallExecuteSequence.WRows("InstallFinalize")
intSequence = rowInstallExecute("Sequence")
then you can try attempting to generate your CA's using intSequence - 1
or at least doing a check previously, I wrote this code somewhere a while back and are well across what you are trying to achieve. If you need any further assistance let me know.
I have done it in both wise macro and using the automation objects.
have a read of this ..
http://johnmcfadyen.spaces.live.com/blog/cns!9DD01136FC094724!167.entry
in relation to what you are doing if you using Wise Macro's to do this you can do something along the lines of this
set tblInstallExecuteSequence = WTables("InstallExecuteSequence")
set rowInstallExecute = tblInstallExecuteSequence.WRows("InstallFinalize")
intSequence = rowInstallExecute("Sequence")
then you can try attempting to generate your CA's using intSequence - 1
or at least doing a check previously, I wrote this code somewhere a while back and are well across what you are trying to achieve. If you need any further assistance let me know.
I have done it in both wise macro and using the automation objects.
Posted by:
anonymous_9363
16 years ago
ORIGINAL: simoncummingsNot at all.
This may be a difficult question to answer I think [>:].
- To pass data from the ExecuteImmediate (EI) sequence to the ExecuteDeferred (ED) sequence, you must use the special 'CustomActionData' property. MSDN explains this rather well but, in essence, you use an EI CA to set a property whose name matches that of the ED CA. Then, in the ED CA, you obtain that data by reference to a property called 'CustomActionData'. If you need to pass more than one "set" of data, use a separator for the property value and then have your CA parse that value using the separator.
- You cannot insert actions after Installfinalize in the ED sequence.
Some light reading:
http://juice.altiris.com/article/3594/guidelines-custom-action-location
and
http://msdn.microsoft.com/en-us/library/aa368066%28VS.85%29.aspx
Posted by:
simoncummings
16 years ago
This may be a difficult question to answer I think [>:].
Still stands!
VBScab.... thanks for trying, but you've misunderstood the question. Using data in the ED sequence is not the problem - that's simple enough.
The problem is when trying to insert a ED CA, before the ED InstallFinalize.
In simple terms, what sequence number do I use? If I cannot pragmatically identify the sequence number of the ED InstallFinalize, I cannot give my ED CA a decremented sequence value.
Simon.
Posted by:
AngelD
16 years ago
Posted by:
anonymous_9363
16 years ago
ORIGINAL: simoncummingsWhy do you want to programmatically assign the sequence number? Besides anything else, I don't believe you can, since - off the top of my head - that would involve writing a new row value into the database which, since the engine has it open, would be impossible. Your only recourse then would be to copy the MSI to a temporary location, write the new value then call the install using the modified MSI. Hideously complex...
In simple terms, what sequence number do I use? If I cannot pragmatically identify the sequence number of the ED InstallFinalize, I cannot give my ED CA a decremented sequence value.
If, as I suspect, you want to ensure that Action A has taken place before Action B is executed, why not set a condition on Action B?
Posted by:
simoncummings
16 years ago
I think I've just answered my own question. [:D]
I think I was making this more complicated than it needed to be or just not understanding the order of things. Wise confuses you by showing two sequence dialogs, one for EI and one for ED, when in reality there is only one sequence, it just gets looped through twice, the second time acutally commiting the changes.
Thanks everyone.
- The InstallExecuteSequence table controls the order of things, as it suggests. It is the properties of the CustomAction itself (the TYPE column in the CustomAction Table) which control whether it runs as EI or ED.
- The default running order of Windows installer is EI then ED.
- So as long as I identify the InstallFinalize Action in the InstallExecuteSequence Table (e.g.: 6500) and place my CustomAction(s) before that (e.g: 6499 - assuming nothing exists already - which I can move) the default Windows Installer sequencing will run through the same order in the InstallExecuteSequence Table firstly as EI then as ED. If the properties of my CustomAction identify it as ED then that's when it will run.
I think I was making this more complicated than it needed to be or just not understanding the order of things. Wise confuses you by showing two sequence dialogs, one for EI and one for ED, when in reality there is only one sequence, it just gets looped through twice, the second time acutally commiting the changes.
Thanks everyone.
Posted by:
simoncummings
16 years ago
John,
Many thanks for your input. Your blog is full of really good technical information. However, and without meaning to offend, when I took a look at your diagram... I found the image quality was not too great and the written text not very clear - although the information is obviously fine. Perhaps a higher-res image would be more useful [:)]
Also, from the wealth of information provided, It still took me a while to figure out the fact that it's loops through the same install sequence twice - probably just my lack of intelligence. Perhaps you could figure a way of explaining this in a form of summary by using some of what we've said in this thread.
Also, I'd never thought of using Wise Macros - didn't even realise they existed.... I'll take a look
Thanks again,
Simon.
Many thanks for your input. Your blog is full of really good technical information. However, and without meaning to offend, when I took a look at your diagram... I found the image quality was not too great and the written text not very clear - although the information is obviously fine. Perhaps a higher-res image would be more useful [:)]
Also, from the wealth of information provided, It still took me a while to figure out the fact that it's loops through the same install sequence twice - probably just my lack of intelligence. Perhaps you could figure a way of explaining this in a form of summary by using some of what we've said in this thread.
Also, I'd never thought of using Wise Macros - didn't even realise they existed.... I'll take a look
Thanks again,
Simon.
Posted by:
AngelD
16 years ago
Posted by:
simoncummings
16 years ago
Posted by:
jmcfadyen
16 years ago

so that the conversation will remain readable.