Set Wix property only if certain condition is met
Asked Answered
S

1

5

What I would like to do is this:

<Property Id="LICENSEKEYPATH">
      REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE
      <DirectorySearch Id="ProgramDataSearch" AssignToProperty="yes" Depth="4" Path="[#ProductDirInAppData]">
        <FileSearch Id="LicenseFileSearch" Name="lic-conf.enp"/>
      </DirectorySearch>
</Property>

When my application is being uninstalled, only then, do I want to search for the license file and get its path. Currently, although the code doesnt give any errors, it still searches for the license file path even when I am installing the file. Because of this, the setup gets delayed by a long time. And more importantly, the wix setup displays in the first screen to the effect that its searching for this property and then it continues with the other screens.

So, how do I search for a file or set the value of a property only during uninstallation?

Stelu answered 31/7, 2009 at 23:9 Comment(0)
L
7

You can control the setting of a property using the SetProperty element. That is just a shortcut for registering a custom action. You can control when the SetProperty executes using a Conditoin in the text element.

As for AppSearch (XxxSearch elements), you can add a condition like the one above to the AppSearch element so that it only runs during uninstall. Note that the conditioning the AppSearch element will affect all XxxSearch elements. So if you need to have a search working during install and another search only during uninstall, that is not possible.

PS: The condition you want will look something like:

Installed AND REMOVE="ALL"

Lone answered 1/8, 2009 at 4:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.