I'm building a MSI setup file using WiX Toolset v3.10.2. I'm using InstallScope='perMachine' so the program gets installed in the Program Files folder.
However, I need to install one (settings) file to the Application Data Roaming folder of the current user.
<Directory Id="AppDataFolder">
<Directory Id="ManufacturerAppDataFolder" Name="Manufacturer">
<Directory Id="ProductAppDataFolder" Name="ProductName">
<Component Id="AppDataConfig" Guid="643DB270-8D85-467B-A6BA-9A54924655E0" Feature="MainApplication">
<RemoveFolder Id='RemoveProductAppDataFolder' Directory='ProductAppDataFolder' On='uninstall' />
<RemoveFolder Id='RemoveManufacturerAppDataFolder' Directory='ManufacturerAppDataFolder' On='uninstall' />
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Name="UserConfigLocation" Value='[ProductAppDataFolder]' KeyPath='yes' />
<File Source="Files\user.settings" />
</Component>
</Directory>
</Directory>
</Directory>
I'm getting this warning when I'm running light.exe:
warning LGHT1076 : ICE91: The file 'user.settings' will be installed
to the per user directory 'ProductAppDataFolder' that doesn't vary based
on ALLUSERS value. This file won't be copied to each user's profile even
if a per machine installation is desired.
I'm installing the MSI on the administrator user ("FirstUser") of a Windows 10 PC, and the settings file is correctly installed at
c:\Users\FirstUser\AppData\Roaming\Manufacturer\ProductName\user.settings
If I login to another user account ("SecondUser"), a new settings file appears at
c:\Users\SecondUser\AppData\Roaming\Manufacturer\ProductName\user.settings
However, after I run the uninstall program while logged in the administrator account ("FirstUser"), the settings file is only deleted from the AppData folder of the FirstUser. The settings file in the AppData folder of the SecondUser is not deleted, it is left on disk.
What is the proper way to install a file in the Application Data folder, so it gets created for every user, and also removed for every user on uninstall?