Wix - 根据权限更改安装文件夹 [英] Wix - change the installation folder based on privilege
本文介绍了Wix - 根据权限更改安装文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须使用 Wix 创建一个安装包.如果管理员用户正在安装软件包,则应将其安装到 %programfiles%/[applicationName] 中,如果用户是非管理员用户,则应将其安装到其本地配置文件文件夹 (LocalAppDataFolder) 中.
I have to create an installation package using Wix. If an admin user is installing the package, it should install into %programfiles%/[applicationName], if the user is an non-admin user then it should install into its local profile folder( LocalAppDataFolder).
怎么可能?
推荐答案
我为 ClickThrough 很久以前.解决方案看起来很像这样(您提供了一个名为ApplicationFolderName"的属性):
I wrote this for ClickThrough a long time ago. Solution from that looks a lot like this (You provide a Property called "ApplicationFolderName"):
<Property Id="A" Secure="yes" />
<DirectoryRef Id="TARGETDIR">
<Directory Id="ApplicationFolder" Name="App" />
</DirectoryRef>
<Condition Message="Must specify TARGETDIR property when doing an administrative install.">Installed OR (ACTION="ADMIN" AND TARGETDIR<>"")</Condition>
<CustomAction Id="TARGETDIRtoA" Property="A" Value="[TARGETDIR]" Execute="firstSequence" />
<CustomAction Id="SpecifiedA" Property="ApplicationFolder" Value="[A]" Execute="immediate" />
<CustomAction Id="PerMachineInstall" Property="ApplicationFolder" Value="[ProgramFilesFolder]\[ApplicationFolderName]" Execute="immediate" />
<CustomAction Id="PerUserInstall" Property="ApplicationFolder" Value="[LocalAppDataFolder]\Apps\[ApplicationFolderName]" Execute="immediate" />
<InstallUISequence>
<Custom Action="SpecifiedA" Before="LaunchConditions">NOT Installed</Custom>
</InstallUISequence>
<InstallExecuteSequence>
<Custom Action="PerMachineInstall" Before="CostFinalize">NOT Installed AND ACTION="INSTALL" AND A="" AND (ALLUSERS=1 OR (ALLUSERS=2 AND Privileged))</Custom>
<Custom Action="PerUserInstall" Before="CostFinalize">NOT Installed AND ACTION="INSTALL" AND A="" AND (ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged))</Custom>
</InstallExecuteSequence>
这篇关于Wix - 根据权限更改安装文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文