I have simple C# console application:
static int main(string[] args){
return SomeBoolMethod() ? 1:0;
}
How in WiX 2.0 should I define property and set this value to it? I don't care about future upgrade/uninstall
UPD开发者_JAVA技巧
I want latter use this property in condition: so the group B
will not execute if MYPROPERTY == 0
but all further components in feature F_A
will
I.E.
<Feature Id="F_A" Level="1">
<Condition Level="0">NOT INSTALLED</Condition> <!-- Another custom property -->
<ComponentGroupRef Id="B" />
<ComponentRef Id="C_AnotherComponent" />
</Feature>
<ComponentGroup Id="B">
<Condition Level="0">NOT MYPROPERTY</Condition> <!-- property that set in console-->
<ComponentRef Id="C_ComponentName" />
</ComponentGroup>
TIA
Executables that are run as Custom Actions do not have access to the Installation session, so they cannot modify a property. Ideally you would rewrite the code that's currently in an exe to reside in a dll, so it could be called as a dll custom action.
If you cannot rewrite things (perhaps you received the exe from elsewhere), you would need to write a dll custom action that launches the exe, examines its exit code, and sets properties accordingly.
In neither case do you need to predefine the property; you can just set it in the dll custom action. In both cases, if the dll is written in C# you will have to use a technology like DTF to invoke it, as Windows Installer cannot directly invoke managed code.
精彩评论