|Windows Installer Basics: Dual Purpose Packages|
A Dual Purpose Package (DPP) uses Single Package Authoring to create a package that can install per-user or per-machine.
In Windows 7 onwards the "MSIINSTALLPERUSER" propery and other Windows Installer 5.0+ enhancements makes this a relatively simple process but this will be more completed in prior operating systems as shown in the "TryMeDualPurposePackage-SupportsWinXP.MM" example.
Prior to Windows Installer 5.0 properties such as "ProgramFilesFolder" always pointed to per-machine locations even when installing per-user and so these can't be used when supporting older operating systems.
This is some Microsoft documentation on Single Package Authoring, some other links: