Wix 使用總結(續)--關於Feature和Component的狀態判斷安裝過程

 

安裝過程中,有時候需要根據用戶的設置來進行不同的安裝,其中一個方面就是根據用戶選擇安裝的Feature或者Component,來判斷下一步的操作。
    Wix
中提供了相關的判斷方法和內置的狀態值。
    Prepending some special characters to the names will give them extra meaning:
    %  environment variable (name is case insensitive)
    $   action state of component
    ?   installed state of component
    &   action state of feature
    !   installed state of feature

    The last four can return the following integer values:
   -1   no action to be taken
   1   advertised (only for components)
   2   not present
   3   on the local computer
   4   run from the source

A few examples to make things clearer:

(&FeatureName = 3) AND NOT (!FeatureName = 3)

Run action only if the product will be installed locally. Do not run action on a reinstallation.

The term &FeatureName = 3 means the action is to install the feature locally.

The term NOT (!FeatureName = 3) means the feature is not installed locally.

 

 (&FeatureName = 2) AND (!FeatureName = 3)

Run action only if the feature will be uninstalled.

This condition only checks for a transition of the feature from an installed state of local to the absent state.

 

(?ComponentName = 3) AND ($ComponentName = 2 OR $ComponentName = 4)

Run action only if the component was installed locally, but is transitioning out of state.

The term ?ComponentName = 3 means the component is installed locally.

The term $ComponentName = 2 means that the action state on the component is absent.

The term $ComponentName = 4 means that the action state on the component is run from source. Note that an action state of advertise is not valid for a component.

 

?ComponentName = $ComponentName

Run action only on the reinstallation of a component.

 

發佈了29 篇原創文章 · 獲贊 3 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章