我必須使用Wix創建安裝包。如果管理員用戶正在安裝該軟件包,則應該將其安裝到%programfiles%/ [applicationName]中,如果該用戶是非管理員用戶,則應該將其安裝到其本地配置文件文件夾(LocalAppDataFolder)中。Wix - 根據權限更改安裝文件夾
怎麼可能?
我必須使用Wix創建安裝包。如果管理員用戶正在安裝該軟件包,則應該將其安裝到%programfiles%/ [applicationName]中,如果該用戶是非管理員用戶,則應該將其安裝到其本地配置文件文件夾(LocalAppDataFolder)中。Wix - 根據權限更改安裝文件夾
怎麼可能?
很久以前我爲ClickThrough寫了這個。從解決方案看起來很像這個(您提供了一個名爲「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工程工作 目前我使用ADMINUSER =「1」來判斷如果我們根據管理員權限
重寫ProgramFilesFolder財產以下應該工作:
<SetProperty Id="ProgramFilesFolder" Value="[AppDataFolder]" Before="CostFinalize"><![CDATA[ NOT Privileged]]></SetProperty>
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="INSTALLDIR" Name="My Folder">
...
</Directory>
</Directory>
集PROPERT y ALLUSERS變爲2.也參見Single Package Authoring。