How do I fix the upgrade logic of a wix setup after changing InstallScope to “perMachine”

后端 未结 5 753
孤独总比滥情好
孤独总比滥情好 2020-12-05 20:25

We use wix to create setups for our application. For the case where the user has already installed an older version of our application, we do a major upgrade with the MajorU

5条回答
  •  抹茶落季
    2020-12-05 20:42

    This finds both existing perUser and/or perMachine installs. And forces the new install to a perMachine install (obviously logic to make that conditional could be applied as you wished). This works when run as an ordinary install and when installed silently under LocalSystem (silent upgrades). Keep in mind, it can only find a perUser install when running as that user.

    Create a custom action (in DLL)

    #pragma comment(linker, "/EXPORT:RunFindRelatedProducts=_RunFindRelatedProducts@4")
    extern "C" __declspec(dllexport) UINT __stdcall RunFindRelatedProducts(MSIHANDLE a_hInstall)
    {
    MsiSetProperty(a_hInstall, "ALLUSERS", "1");
    MsiDoAction(a_hInstall, "FindRelatedProducts");
    MsiSetProperty(a_hInstall, "ALLUSERS", "");
    MsiDoAction(a_hInstall, "FindRelatedProducts");
    MsiSetProperty(a_hInstall, "ALLUSERS", "1");
    return ERROR_SUCCESS;
    }//end function
    

    Then "replace" the standard FindRelatedProducts with the custom action

    
      0
      NOT Installed
    
    
      0
      NOT Installed
    
    

提交回复
热议问题