[英]WIX Installer Adding and Removing files in LocalAppDataFolder
I have an Internet Explorer Add-On that generates some files in LocalAppDataFolder\\Microsoft\\Windows\\Temporary Internet Files\\CompanyName\\AddOnName\\ 我有一个Internet Explorer加载项,它会在LocalAppDataFolder \\ Microsoft \\ Windows \\ Temporary Internet Files \\ CompanyName \\ AddOnName \\中生成一些文件
I have a WIX installer for the application that I would like to have delete the CompanyName\\AddOnName\\ folders on both install and uninstall. 我有一个用于该应用程序的WIX安装程序,我想在安装和卸载过程中都删除CompanyName \\ AddOnName \\文件夹。
I have never used WIX before, and I'm more of a MacOS guy, so all of this stuff is a bit foreign to me. 我以前从未使用过WIX,而我更像是MacOS人士,所以所有这些东西对我来说都是有点陌生。 Here is a portion of what I have right now (in my Product.wxs file):
这是我现在拥有的一部分(在我的Product.wxs文件中):
<Feature Id="ProductFeature" Title="Company IE Add-On" Level="1" ConfigurableDirectory="INSTALLFOLDER">
<ComponentRef Id="INSTALLFOLDER" />
<ComponentGroupRef Id="ProductComponents" />
<ComponentRef Id="dataDirectory"/>
</Feature>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Company IE Add-On" >
<Component Id="INSTALLFOLDER" Guid="THERE IS A GUID HERE">
<RemoveFolder On="both" Id="INSTALLFOLDER"/>
<RegistryValue Root="HKLM" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="Company IE Add-On" />
</Component>
</Directory>
</Directory>
<Directory Id="LocalAppDataFolder">
<Directory Id="Microsoft">
<Directory Id="Windows">
<Directory Id="TempInetFiles" Name="Temporary Internet Files">
<Directory Id="CompanyName">
<Directory Id="AddOnName">
<Component Id="dataDirectory" Guid="E5938D44-5315-43D4-94EC-313F6CDB290B" NeverOverwrite="no" Permanent="no">
<RemoveFolder Id="AddOnName" On="both"/>
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
But this is giving me errors like "Component dataDirectory installs to user profile. It must use a registry key under HKCU as its KeyPath, not a file." 但这给了我诸如“将组件dataDirectory安装到用户配置文件。它必须使用HKCU下的注册表项作为其KeyPath而不是文件的错误”。
And "The directory CompanyName is in the user profile but is not listed in the RemoveFile table." 和“目录CompanyName在用户配置文件中,但未在RemoveFile表中列出。”
Any help would be greatly appreciated. 任何帮助将不胜感激。 Thanks.
谢谢。
I do something similar and this code works for me: 我做了类似的事情,此代码对我有用:
<!--Setting up the shortcuts for the product-->
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="$(var.ShortcutName)">
<Directory Id="ProgramMenuSubFolder" Name="LOGGERS">
</Directory>
</Directory>
</Directory>
</Directory>
<Component Id='LoggersShortcut' Guid='2A6D411E-5CE9-4F38-8F25-361CBFCABB5A' Directory='ProgramMenuSubFolder'>
<CreateFolder Directory="ProgramMenuSubFolder" />
<RemoveFolder Id='ProgramMenuSubFolder' On='uninstall' Directory='ProgramMenuSubFolder'/>
<RegistryValue Root='HKCU' Key='Software\ShortcutProperty\[PRODUCTNAME]' Type='string' Value='1' KeyPath='yes' />
</Component>
WiX requires that you always use an HKCU registry entry whenever creating a user-specific component. WiX要求您在创建用户特定组件时始终使用HKCU注册表项。 In this case, dataDirectory will always be installed in the current user's profile.
在这种情况下,dataDirectory将始终安装在当前用户的配置文件中。 Add an HKCU or HKMU registry element inside the component as in:
在组件内部添加HKCU或HKMU注册表元素,如下所示:
<Component Id="dataDirectory" Guid="E5938D44-5315-43D4-94EC-313F6CDB290B" NeverOverwrite="no" Permanent="no">
<Registry Root='HKMU' Key='Software\[Manufacturer]\[ProductName]' KeyPath='yes'/>
<RemoveFolder Id="AddOnName" On="both"/>
</Component>
This will not have any visible effect in case of a per-machine installation as you already have HKLM\\Software[Manufacturer][ProductName]. 如果您已经安装了HKLM \\ Software [Manufacturer] [ProductName],则在每台计算机安装的情况下这不会产生任何可见的效果。 In case of a per-user installation, it will create HKCU\\Software[Manufacturer][ProductName].
如果是按用户安装,它将创建HKCU \\ Software [Manufacturer] [ProductName]。
Replace the HKMU with HKCU if it still fails with the same error. 如果HKMU仍然失败并出现相同的错误,请用HKCU替换HKMU。
For the second problem, check out: Directory xx is in the user profile but is not listed in the RemoveFile table. 对于第二个问题,请签出: 目录xx在用户配置文件中,但未在RemoveFile表中列出。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.