Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install to LocalAppData folder?

Tags:

Following directory setting works perfectly for me.

<Directory Id='TARGETDIR' Name='SourceDir'>   <Directory Id="ProgramFilesFolder">     <Directory Id='INSTALLDIR' Name='MyApp'/>   </Directory> </Directory> 

However, when I tried changing "ProgramFilesFolder" to "LocalAppDataFolder", I got lots of error when using light to link and generate my msi:

D:\runGroup.wxs(53) : error LGHT0204: ICE38: Component cmpA5561BE36D80EB58252E69DDA0C2FF8C installs to user profile. It must use a registry key under HKCU as its KeyPath, not a file. D:\main.wxs(38) : error LGHT0204 : ICE64: The directory INSTALLDIR is in the user profile but is not listed in the Remove File table.

Looks like "LocalAppDataFolder" is not acceptable for WiX, while I believe it is one of the system folder properties which defined in here.

What am I supposed to use for LocalAppData folder?

like image 984
Deqing Avatar asked Aug 24 '12 03:08

Deqing


People also ask

Where is LocalAppData located Windows 10?

It is located in C:\Users\<username>\AppData. If you open this folder, you will find three subfolders - Local, LocalLow, and Roaming - each containing particular AppData folders.

What does this mean LocalAppData?

AppData is the folder where Windows saves all the configuration information of the applications installed on your computer, having one for each of the users that you have created. It is to protect user data and settings from any unwanted change or deletion.

Where is LocalAppData Windows 11?

To find the AppData folder on your Windows 11 device, first, open the C drive and then open the Users folder. After that, open your user profile folder. You will find the AppData folder inside that folder. If the AppData folder is not there, enable the Show hidden files and folders option in the File Explorer.


2 Answers

I converted an application from being a perMachine install to be a perUser install. In order to properly convert the install I had to add a registry key for each of the components I have.

Originally I had the following:

<Component Id="C.MyExe">   <File Id="Fi.MyExe" Name="$(var.MyExe.TargetFileName)" Source="$(var.MyExe.TargetPath)" DiskId="1">     <Shortcut Id="SC.StartMenu"               Directory="D.ApplicationMenuDir"               Name="$(var.AppName)"               WorkingDirectory="INSTALLDIR"               Icon="MY_ICON.ico"               IconIndex="0"                Advertise="yes"       />       ... 

When I moved the exe component to the user install I had to do something like this:

<Directory Id="LocalAppDataFolder" Name="AppData">   <Directory Id="MyAppDirectory" Name="$(var.AppName)">     <Component Id="C.MyExe" Guid="{MY_GUID}">       <CreateFolder />       <RemoveFolder Id="RemoveMyAppDirectory" On="uninstall" />       <RegistryKey Root="HKCU" Key="Software\MyCompany\MyApp">         <RegistryValue Name="MainExe" Value="1" KeyPath="yes" Type="integer" />       </RegistryKey>       <File Id="Fi.MyExe" Name="$(var.MyExe.TargetFileName)"           Source="$(var.MyExe.TargetPath)" DiskId="1" Checksum="yes">       </File>     </Component>    ... 

The most important part is that you will have to add a registry key which points to HKEY_CURRENT_USER. I added a registry value for each component which indicates that the component is installed.

I also had to remove the following: Advertise="yes".

like image 59
tronda Avatar answered Sep 19 '22 13:09

tronda


I had this problem recently. I wanted to convert my installer from per-machine to a per-user but was getting ICE38. I asked on wix-users and one opinion was that you can ignore ICE38 because that was meant as a check for per-machine installs.

See the discussion at wix-users.

Since that is the case, ICE38 is (in my opinion) incorrect and you will want to ignore it. ICE38 implies you are installing per-user resources in the context of a per-machine installation but never verifies that this is so.

Actually authoring a per-user install requires that you ignore ICE38 because it won't ever be accurate for that world.

[Edit] Looks like you got help here.

From Peter Shirtcliffe:

This is my own, admittedly inexpert, understanding of per-user installations:

Installing to subdirectory of LocalAppDataFolder is perfectly OK in a per-user MSI. Because of certain scenarios relating to roaming users, you need to add components containing elements for any directories you create under LocalAppDataFolder. That's why ICE64 is appearing.

The ICE38 error is slightly misleading: since you have a per-user installation, it's safe to ignore as long as the user cannot pick an alternative installation location that is common to all users. ICE38 is checking for the situation where multiple users all install the same component to the same path.

Just posting to help other people (like me).

like image 28
Wes Avatar answered Sep 18 '22 13:09

Wes