I tried all the scenarios for creating a single MSI for per-user and per-machine. Below is my explanation: According to https://blogs.msdn.microsoft.com/windows_installer_team/2009/09/02/authoring-a-single-package-for-per-user-or-per-machine-installation-context-in-windows-7/
<Property Id='ALLUSERS' Value='2' />
<Property Id='MSIINSTALLPERUSER' Value='{}' />
Results in a per-machine installation and the value of MSIINSTALLPERUSER is "1" results in per-user installation.
Now I am running a custom action which determines the user is whether admin or not and so changing the property value to be {} or 1.
My problem is the value of "ALLUSER" is changed to 1 Before logging during installation. The log created shows:
"PROPERTY CHANGE: Modifying ALLUSERS property. Its current value is '2'. Its new value: '1'."
But When i run by directly giving MSIPERUSER Value as "1" The log shows:
"PROPERTY CHANGE: Deleting ALLUSERS property. Its current value is '2'."
So please help me how can i develop a single installer for both admin user and normal user.
Thanks in advance.
Basically you follow the rules here:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd408068(v=vs.85).aspx
The point here is that Windows decides how the install works based on the user's privileges, not you with a custom action. That's why the property values change. Follow those rules and it just works.