开发者

wired problem about wix condition message

开发者 https://www.devze.com 2023-02-12 21:09 出处:网络
The following is my code <?xml version=\"1.0\" encoding=\"UTF-8\"?> <Wix xmlns=\"http://schemas.microsoft.com/wix/2006/wi\">

The following is my code

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="928a18b3-0f75-4b89-844f-a5699a549011" Name="ExperimentNew" Language="1033" Version="1.0.0.0" Manufacturer="Experiment" UpgradeCode="17929f52-f868-4164-96f6-c47b62781041"&g开发者_运维百科t;
        <Package InstallerVersion="200" Compressed="yes" />
    <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />   
    <Property Id="ODPNETINSTALLED" Value="1"></Property>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLLOCATION" Name="Experiment">
          <Component Id ="main_test_file" Guid="{914ED802-82EF-4296-85F2-4095DE0AAC1D}" KeyPath="yes">
            <File Id="file1" Source=".\try.bat"></File>
          </Component>
        </Directory>
      </Directory>
    </Directory>
    <Feature Id="ProductFeature" Title="Experiment" Level="1">
      <ComponentRef Id="main_test_file"/>
      <ComponentGroupRef Id="Product.Generated" />
    </Feature>
    <CustomAction Id ="SetProperty" Property="ODPNETINSTALLED" Value="0"></CustomAction>
    <InstallExecuteSequence>
      <Custom Action="SetProperty" Before="LaunchConditions" ></Custom>
    </InstallExecuteSequence>
    <Condition Message="SHOULD NOT APPEAR"><![CDATA[ODPNETINSTALLED="0"]]></Condition>
    <UI>
      <UIRef Id="WixUI_Minimal" />
    </UI>
    </Product>
</Wix>

I want to change the value of "ODPNETINSTALLED" in custom action "SetProperty" so i expect the condition message will not pop up. but it shows every time at the first beginning of install - why is this?

I also make the following change:

<Property Id="ODPNETINSTALLED" Value="0"></Property> 
<CustomAction Id  ="SetProperty" Property="ODPNETINSTALLED"  Value="1"></CustomAction>

Then the condition message shows after accept licence agreement.


I'm not sure I understand the code you mentioned entirely, but I suspect that the issue in this particular case might be related to the sequence you'd like your action to run in. You schedule it in InstallExecuteSequence, but you probably expect it to run earlier. LaunchConditions action is scheduled for both InstallUISequence and InstallExecuteSequence, hence in other than minimal UI it runs in InstallUISequence first. As long as your action influences LaunchConditions, I think you should do the same.

So:

  • in your CA definition add Execute="firstSequence" attribute
  • schedule your action into both InstallUISequence and InstallExecuteSequence

A side note: I would change the logic you use to set a property and detect if it's set. Instead of setting it to default value, and later change to the desired value, you can simply avoid setting it by default. Then have this CA to set the ODPNETINSTALLED property when it needs to be set. And all checks and conditions will verify if the property is defined or not, instead of checking the specific value. I.e. NOT ODPNETINSTALLED, instead of ODPNETINSTALLED <> 1, or something.

Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消