I'm using Microsoft Visual Studio 2019 and Microsoft Visual Studio Installer Projects V1.0.2.
I'm aware how to generate a system wide installer:
InstallAllUsersproperty of the setup project is set to true.InstallAllUserVisibleproperty of theInstallation Folderuser interface is set to false.- The
DefaultLocationof theApplication Folderis set to[ProgramFilesFolder][Manufacturer]\[ProductName].
and I'm as well aware how to generate a user installer where no admin elevation is needed:
InstallAllUsersproperty of the setup project is set to false.InstallAllUserVisibleproperty of theInstallation Folderuser interface is set to false.- The
DefaultLocationof theApplication Folderis set to[LocalAppDataFolder]\Programs\[Manufacturer]\[ProductName]. - PostBuildEvent:
"%ProgramFiles%\Windows Kits\10\bin\x86\MsiInfo.exe" "$(BuiltOuputPath)" /w 10
See https://stackoverflow.com/a/55700346/7556646 and https://superuser.com/a/1633474/738960.
Now I'm asking myself the following questions:
is the possibility to have the system installer and the user installer in the same msi-file and in the same setup project?
Is it possible that the
DefaultLocationof theApplication Folderis set based on theInstallAllUsersproperty? TheInstallAllUsersproperty can be changed in theInstallation Folderuser interface when theInstallAllUserVisibleproperty is set to true.Would the above post build event a problem for system wide install?
Yes, in fact that is the normal way to build an MSI package so that the system administrator can choose what type of installation is appropriate for their environment. During the initial UI phase of the installer, or by properties on an unattended installation, the administrator will pick if they want a "Only Me" or a "All Users" installation. Although rarely used there are other installation options like network based administrative installation point installations that an admin may like to also see you supporting.
Yes, but don't do that. The target folder should be set by command line or by the UI, not by your package. Refer to the TARGETDIR property documentation for more detail. By default Windows Installer will construct a suitable location from properties already present in your package.