“Hide” Features Based on ALLUSERS / MSIINSTALLPERUSER

后端 未结 1 1343
情深已故
情深已故 2021-01-23 11:47

I have an installer that I\'m converting from being an admin-only installation into a Single Package Authoring installer capable of being installed for the current user or for a

1条回答
  •  清酒与你
    2021-01-23 12:12

    Per-User Setups: I won't lie to you, I actively avoid this sort of setup. I find MSI's per-user installation constructs "not ideal". It relates to poor serviceability (upgrades, patching, etc...) and a number of other details. Some details mid-page here.

    Some links for others who read this answer (I think you have read these):

    • Nice summary page on single package authoring from Advanced Installer
    • Single Package Authoring
    • Installation context
    • MSIINSTALLPERUSER

    Feature Conditions: With that said you can use feature conditions to unselect features based on whether a certain condition is true or false. You can even set the Level of a feature to 0 which will hide it from the GUI entirely during installation. You could try this. Please also read the linked answer below (bolded). It contains a better explanation of feature conditions.

    I don't have time to test this, but here is a WiX mock-up that you can try:

     
    
         
           ALLUSERS=2 OR MSIINSTALLPERUSER=1
        
    
    
    

    These answers might help you get an overview of this:

    • How to set the level of feature based on condition in wix? (please do read this one).

    • InstallShield conditional feature installation

    • Failing condition wix


    Hide Feature Testing: I will add a little snippet you can use to verify the operation of the feature hiding. It forces the condition in question to be true by setting it to 1 - as opposed to using a "real condition" that can be false unexpectedly.

    
       1
    
    

    This should hide the SupportingFiles feature from view in the setup GUI, and it should also not install it. Please let me know if you see a different behavior.


    Custom Actions: To interactively hide a feature based on changes done in the GUI, you can try to use custom actions to control the feature levels.

    • Unselected Feature Being Installed

    I am not sure this will work. I will test when I get the chance. Just adding that link for now.

    UPDATE: I am unable to investigate this right now. I want to alert you to the possibility of adding temporary rows to the database during installation. Perhaps this is the way to go to hide the feature "interactively". I just don't know since I have never tried. Here is the first link I found on temporary records. And towards the bottom here are links. No guarantees.

    Other than that I suppose you could use an external GUI launcher. I might comment on this later. I recently wrote about this issue (external GUI).


    Some Further Links For Reference:

    • How to set the level of feature based on condition in wix?
    • Unselected Feature Being Installed
    • WiX Checkbox property only working if default value given

    0 讨论(0)
提交回复
热议问题