简体   繁体   中英

WIX: How to set Property from .NET console application

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

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 IE

  <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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM