Wix 工具集 - 为用户配置文件文件夹路径和程序文件设置属性 [英] Wix Toolset - Setting a Property to User Profile Folder path and Program Files
问题描述
我正在使用属性来设置注册表项的值.这是因为在第一次安装时我有一个默认值,然后在升级时使用当前的注册表值.
I am using Properties to set the values of Registry entries. This is so that on install the first time I have a default value and then on upgrade the current registry value is used.
我需要一个属性来设置用户本地文件夹和程序文件夹的路径.我知道下面的代码是错误的,但我该怎么做.我想至少我想做一个 Type 51 自定义操作,但不了解文档.
I need to have a property that sets the path to the user's local folder and to the programs folder. I know the below code is wrong but how do I do it. I think at least I want to do a Type 51 custom action but don't understand the documentation.
我认为有三个相关部分
<InstallExecuteSequence>
<Custom Action="SetUserFolder" Before="InstallInitialize"/>
<Custom Action="SetInstallFolder" Before="InstallInitialize"/>
</InstallExecuteSequence>
自定义操作
<CustomAction Id="SetUserFolder" Property="UserFolder" Value="[%USERPROFILE]" />
<CustomAction Id="SetInstallFolder" Property="P_InstallFolder" Value="[%PROGRAMFILES]" />
财产.
<Property Id="P_MyAPPPATH" Value="[P_InstallFolder]MyApp\">
<RegistrySearch Id="S_MyAppPath" Type="raw" Root="HKCU" Key="Software\MyApp\Settings" Name="MyAppPath"/>
</Property>
<Property Id="P_MyAPPDB" Value="[UserFolder]\MyApp\MyAppData\">
<RegistrySearch Id="S_MyAPPDB" Type="raw" Root="HKCU" Key="Software\MyApp\Settings" Name="MyAppdb"/>
</Property>
推荐答案
作为使用您定义的属性的替代方法,您可以使用一些内置属性来获得更好的效果.
As an alternative to using the properties you're defining, you might be able to use some built-in properties to better effect.
不要使用 %USERPROFILE,请考虑 LocalAppDataFolder.当用户在网络域中的机器之间漫游时,这将避免您的数据在机器之间复制.我猜你不需要那个,但如果你需要,请使用 AppDataFolder 并注意所涉及的延迟.
Instead of %USERPROFILE, consider LocalAppDataFolder. This will avoid your data from being copied between machines as a user roams between machines on a network domain. I'm guessing you don't need that but, if you do, use AppDataFolder and beware of the latencies involved.
而不是 %PROGRAMFILES,请考虑 程序文件文件夹.这似乎是您的意图.
Instead of %PROGRAMFILES, consider ProgramFilesFolder. This seems to be what you intend.
这篇关于Wix 工具集 - 为用户配置文件文件夹路径和程序文件设置属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!