I'm using cMake
+ Wix
to generate my installer. My program must be installed in C:\Users\UserName\MyProgram
of any computer.
The problem is that when I generate an installer with cPack
, I am setting the installation directory like this:
set(CPACK_WIX_SKIP_PROGRAM_FOLDER TRUE)
set(CPACK_PACKAGE_INSTALL_DIRECTORY $ENV{USERPROFILE}\\${CPACK_PACKAGE_VENDOR}\\${CPACK_PACKAGE_NAME})
When I generate the installer and give it to the client to install my program, the program tries to install under the "old" username (the username of the machine where the installer was generated).
C:\Users\OldUserName\MyProgram
This username will not be recognized on the machine that is being installed since it does not exist, since it is the user of the machine where the installer was generated, not the current one.
Why is this happening? Because it is stored as an installation path. I don't know how to tell WIX to take the "Current User" of the machine where the installer is running to generate the installation path.
I do not have the wix + cpack pipeline setup, but found this question interesting. Maybe these information might help.
Note Installers created with this feature do not take differences between the system on which the installer is created and the system on which the installer might be used into account. It is therefore possible that the installer e.g. might try to install onto a drive that is unavailable or unintended or a path that does not follow the localization or convention of the system on which the installation is performed.