问题描述
以下目录设置对我来说非常合适.
Following directory setting works perfectly for me.
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id="ProgramFilesFolder">
<Directory Id='INSTALLDIR' Name='MyApp'/>
</Directory>
</Directory>
但是,当我尝试将"ProgramFilesFolder"更改为" LocalAppDataFolder "时,使用light
链接并生成我的msi时出现了很多错误:
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.
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.
看起来像"LocalAppDataFolder"对于WiX是不可接受的,尽管我相信它是此处.
Looks like "LocalAppDataFolder" is not acceptable for WiX, while I believe it is one of the system folder properties which defined in here.
我应该对LocalAppData文件夹使用什么?
What am I supposed to use for LocalAppData folder?
推荐答案
我将应用程序从perMachine安装转换为perUser安装.为了正确转换安装,我必须为我拥有的每个组件添加一个注册表项.
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.
最初我有以下内容:
<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"
/>
...
将exe组件移至用户安装时,我必须执行以下操作:
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>
...
最重要的部分是您将必须添加指向HKEY_CURRENT_USER
的注册表项.我为每个组件添加了一个注册表值,该值指示该组件已安装.
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.
我还必须删除以下内容:Advertise="yes"
.
I also had to remove the following: Advertise="yes"
.
这篇关于如何安装到LocalAppData文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!