MSI developed on Visual Studio installs to 'C:' instead of 'C:\ProgramFiles' Folder even after the "TARGETDIR" is set to [ProgramFilesFolder][Manufacturer]\[ProductName] by the Custom Action "DIRCA_TARGETDIR".
1. This issue occurs only on Windows Vista and above where group policy 'AlwaysInstallElevated' is set to ‘1’ in both User policy and Machine policy to install the MSI with elevated privleges.
2. When the MSI is executed with Elevated Privileges Windows Installer won't pass any public properties from the client side to the server side, it will mark them as “disallowed property”
3. TARGETDIR (public property) is changed from "C:" to "[ProgramFilesFolder][Manufacturer]\[ProductName]" by DIRCA_TARGETDIR during the execution of the client side and this new value wouldn’t be passed on to the server side as the MSI is being installed with elevated privileges. So, the TARGETDIR property is set back to C:
4. To avoid this add TARGETDIR to ‘SecureCustomProperties’ property in the ‘Property Table’ so that it is passed on to the server side as a Private property and the value wouldn’t be changed to C:
Group Policy 'AlwaysInstallElevated' can be set in "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Installer" for user policy and "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Installer" for machine policy.
Content by : Sarat Chandra