Discussion:
[WiX-users] Managed Bootstrapper: Engine.EvaluateCondition() requires separate thread?
Farrukhw
2015-07-06 11:33:06 UTC
Permalink
Hi,
In my Managed Bootstrapper, I tried to call
Engine.EvaluateCondition("MY_PROG_FOUND"); in Run() method. But it never
evaluates and said something like: "This requires a running thread." and it
never evaluates.

I'm trying to evaluate Bundle conditions in my managed bootstrapper but
still no luck.

MY_PROG_FOUND is defined in Bundle code:
<util:RegistrySearch Id="PETRELINSTALLLOCATION"
Variable="MY_PROG_FOUND"
Root="HKLM"
Key="SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
Value="$(var.my_prog_env_var)"
Result="exists"
/>

<bal:Condition Message="[WixBundleName] required the installation of My
Program.">

</bal:Condition>

How can I use Engine.EvaluateCondition() in managed bootstrapper? Does this
requires to be called in a specific event, like DetectBegin()??

Any help would be really appreciated...
Thanks a bunch.



--
View this message in context: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Managed-Bootstrapper-Engine-EvaluateCondition-requires-separate-thread-tp7600793.html
Sent from the wix-users mailing list archive at Nabble.com.
Farrukhw
2015-07-08 10:31:01 UTC
Permalink
Later I figured out that the separate thread is active during event calls. So
I tried it during *DetectComplete *event and it worked. <br/> <br/> But
before that, I had to parse *BootstrapperApplicationData.xml* file to get
*WixBalCondition* elements and get the collection into an array e.g.
BalConditions[].

Here is my code snippet:

void BootstrapperApplication_DetectComplete(object sender,
DetectCompleteEventArgs e)
{
string balCondtionMessages = string.Empty;
bool balConditionStatus = true;
foreach (var balCondition in
bootAppData.BundleData.BalConditions)
{
if
(!model.BootstrapperApplication.Engine.EvaluateCondition(balCondition.Condition))
{
balConditionStatus = false;
if (!String.IsNullOrEmpty(balCondtionMessages))
{
balCondtionMessages = balCondtionMessages +
'\n' + "- " + balCondition.Message;
}
else
balCondtionMessages = "- " +
balCondition.Message;
}


}

if (!balConditionStatus)
{
SetbalConditionMsg(balCondtionMessages);
}
}

This makes us parse for all conditions in our Bundle.wxs code, evaluate them
and display the related message in our Custom Bootstrapper UI.
Post by Farrukhw
Hi,
In my Managed Bootstrapper, I tried to call
Engine.EvaluateCondition("MY_PROG_FOUND"); in Run() method. But it never
evaluates and said something like: "This requires a running thread." and
it never evaluates.
I'm trying to evaluate Bundle conditions in my managed bootstrapper but
still no luck.
<util:RegistrySearch Id="PETRELINSTALLLOCATION"
Variable="MY_PROG_FOUND"
Root="HKLM"
Key="SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
Value="$(var.my_prog_env_var)"
Result="exists"
/>
<bal:Condition Message="[WixBundleName] required the installation of My
Program.">
</bal:Condition>
How can I use Engine.EvaluateCondition() in managed bootstrapper? Does
this requires to be called in a specific event, like DetectBegin()??
Any help would be really appreciated...
Thanks a bunch.
--
View this message in context: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Managed-Bootstrapper-Engine-EvaluateCondition-requires-separate-thread-tp7600793p7600836.html
Sent from the wix-users mailing list archive at Nabble.com.

Loading...