Environment Variable expanding in folder name
A bug in Windows Installer expands environment variables present in a folder's name and stops the installation with an error, due to an invalid folder name.
As you can see, the folder %P_%F_%Path%alfa contains in its name the substring Path. This string enclosed by percent sign characters is resolved as a formatted reference by Windows Installer. This happens at install time, while the standard action InstallFiles is executed. For DuplicateFiles standard action we get the same behavior. (files to be installed/copied are in the folder)
Since Path environment variable contains full folder paths we will get the characters “:“ and “\“ in the folder name. Windows Installer will now error out and rollback the installation as these characters are not supported in a folder name.
If the folder is empty, i.e. no files are installed in it, the standard action CreateFolders will work correctly (does not expand the environment variable), creating the folder on the target machine with the name mentioned above. InstallFiles does not get executed in this scenario as no files are present in the folder.
Windows Installer bug?
Even though no official documentation from Microsoft talks about this problem it was validated this is a Windows Installer bug upon similar tests with other MSI authoring tools, as visible in the following StackOverflow.com thread.
The only solution to create a folder with a similar name from an MSI package at this moment is to use a custom action that will create and delete (on uninstall) the folder, then copy/move in it the files you need from another folder found in your setup package. Don't forget about rollback actions too.
Subscribe to Our Newsletter
Sign up for free and be the first to receive the latest news, videos, exclusive How-Tos, and guides from Advanced Installer.