Preventing Wix from installing All Features in my Product?

戏子无情 提交于 2019-12-10 11:49:41

问题


After installing a MSP patch, Windows Installer decides to install ALL Features provided in the initial MSI. How can i prevent MSP patch from installing All available Features?

Features requests show like this:

Installed: Absent
Request: local
Action : local

Why is it requesting to install all?


回答1:


I found out that the ADDLOCAL property was being set to all the Uninstalled Features. This caused a "Request: local" for each one. What i did to solve the issue was to use a small custom action that deletes this property. It needs to go before CostFinalize because the features to be installed need to be defined before that action. The variable REINSTALL holds the features that are already installed, and all of them are requested for REINSTALL. So the MSP patch only REINSTALLs the already installed features and leaves the uninstalled features untouched.

<CustomAction Id="REMOVE_ADDLOCAL_PROPERTY"
       Property="ADDLOCAL" Value="[NonExistentProperty]"
/>
<InstallExecuteSequence>
    <Custom Action="REMOVE_ADDLOCAL_PROPERTY" Before="CostFinalize">
        <![CDATA[PATCH]]>
    </Custom>
</InstallExecuteSequence>

EDIT: In the end, this solution worked for one of my patches, but failed for another. So the final solution i've implemented so far is to set REINSTALL=ALL during the Patch.This MSDN link stands that:

Note that even if REINSTALL is set to ALL, only those features that were already installed previously are reinstalled. Thus, if REINSTALL is set for a product that is yet to be installed, no installation action will take place at all.

so i think this is a better solution than removing the ADDLOCAL property. And also it worked for both patches.




回答2:


You have to save the selected features to the registry upon initial installation, ADDLOCAL property. When installing the patch, it has to read the states from the registry setup ADDLOCAL property accordingly.

Otherwise the patch runs as if the defaults are selected, and therefore the missing features get installed.

You linked to a question for Upgrade case, MigrateFeatures attribute, which refers to MigrateFeatureStates action, does not work in case of patches.



来源:https://stackoverflow.com/questions/12288780/preventing-wix-from-installing-all-features-in-my-product

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!