wix-获取父目录
我的安装程序需要从注册表中读取一个值,并将安装路径设置为该值的父级 例如,我从注册表中获得:wix-获取父目录,wix,windows-installer,Wix,Windows Installer,我的安装程序需要从注册表中读取一个值,并将安装路径设置为该值的父级 例如,我从注册表中获得: D:\apps\client 然后安装程序应将应用程序安装到 D:\apps 我尝试了[DIR]\..\(在“目录”或“自定义操作”中),但在安装时看到以下错误: Error 1324. The folder path '..' contains an invalid character. 我怎样才能用WiX做到这一点呢?看来你不能用纯WiX做到这一点。您可以使用。在“启动条件”操作之前,以立即模
D:\apps\client
然后安装程序应将应用程序安装到
D:\apps
我尝试了[DIR]\..\
(在“目录”或“自定义操作”中),但在安装时看到以下错误:
Error 1324. The folder path '..' contains an invalid character.
我怎样才能用WiX做到这一点呢?看来你不能用纯WiX做到这一点。您可以使用。在“启动条件”操作之前,以立即模式执行它。在wix代码的某个地方初始化新属性,如:
<Property Id="DIRFROMREG" Value="0" Secure="yes">
最后一件事:
<SetProperty Id="INSTALLLOCATION" Value="[DIRFROMREG]" After="Your custom action">NOT DIRFROMREG=0</SetProperty>
非DIRFROMREG=0
希望这能有所帮助。看来纯wix做不到这一点。您可以使用。在“启动条件”操作之前,以立即模式执行它。在wix代码的某个地方初始化新属性,如:
<Property Id="DIRFROMREG" Value="0" Secure="yes">
最后一件事:
<SetProperty Id="INSTALLLOCATION" Value="[DIRFROMREG]" After="Your custom action">NOT DIRFROMREG=0</SetProperty>
非DIRFROMREG=0
希望这能有所帮助。Nerielle有一个很好的答案。我的安装都会转到子文件夹,因此当我找到旧组件时,我需要父文件夹进行安装,所以我来寻求答案。
从…起 我找到了如何获取父文件夹,因为我有一个已知的固定安装子路径
<!-- Set INSTALLFOLDER from SERVERINSTALLFOLDER without the \Server\ -->
<CustomAction Id="VBScriptInstallFolderFromFoundServer" Script="vbscript">
<![CDATA[
pathvalue = Session.Property("SERVERINSTALLFOLDER")
if pathvalue <> "" Then
Session.Property("INSTALLFOLDER") = Left(pathvalue,Len(pathvalue)-Len("\Server\"))
End If
]]>
</CustomAction>
”“那么
Session.Property(“INSTALLFOLDER”)=左(路径值,Len(路径值)-Len(“\Server\”)
如果结束
]]>
结合
和
正在注册表中存储INSTALLFOLDER路径根据建议,我现在可以更新旧的或安装新的,并获得以前安装的正确安装路径。
vbscript可以更改为使用路径处理函数查找父项,而不是删除固定的子字符串,以便更准确地回答问题,但是…
我的InstallUISequence和InstallExecuteSquence:
<!-- Save INSTALLFOLDER parameter to CMDLINE_INSTALLFOLDER -->
<Custom Action='SaveCmdLineValue' Before='AppSearch' />
<!-- Set INSTALLFOLDER from SERVERINSTALLFOLDER without the \Server\ -->
<Custom Action="VBScriptInstallFolderFromFoundServer" After="AppSearch">
SERVERINSTALLFOLDER
</Custom>
<!-- Set INSTALLFOLDER from parameter CMDLINE_INSTALLFOLDER -->
<Custom Action='SetFromCmdLineValue' After='VBScriptInstallFolderFromFoundServer'>
CMDLINE_INSTALLFOLDER
</Custom>
服务器安装文件夹
CMDLINE\u安装文件夹
最后。。。在产品I中,我将其放在以下片段中:
<!-- Install to previous install path From parameter, OR from found installation OR from registry -->
<CustomActionRef Id='SaveCmdLineValue' />
<PropertyRef Id='INSTALLFOLDER'/><!-- include Fragment -->
<PropertyRef Id='SERVERINSTALLFOLDER'/><!-- include Fragment -->
<CustomActionRef Id='VBScriptInstallFolderFromFoundServer' /><!-- include Fragment -->
内里尔有一个很好的答案。我的安装都会转到子文件夹,因此当我找到旧组件时,我需要父文件夹进行安装,所以我来寻求答案。
从…起 我找到了如何获取父文件夹,因为我有一个已知的固定安装子路径
<!-- Set INSTALLFOLDER from SERVERINSTALLFOLDER without the \Server\ -->
<CustomAction Id="VBScriptInstallFolderFromFoundServer" Script="vbscript">
<![CDATA[
pathvalue = Session.Property("SERVERINSTALLFOLDER")
if pathvalue <> "" Then
Session.Property("INSTALLFOLDER") = Left(pathvalue,Len(pathvalue)-Len("\Server\"))
End If
]]>
</CustomAction>
”“那么
Session.Property(“INSTALLFOLDER”)=左(路径值,Len(路径值)-Len(“\Server\”)
如果结束
]]>
结合
和
正在注册表中存储INSTALLFOLDER路径根据建议,我现在可以更新旧的或安装新的,并获得以前安装的正确安装路径。
vbscript可以更改为使用路径处理函数查找父项,而不是删除固定的子字符串,以便更准确地回答问题,但是…
我的InstallUISequence和InstallExecuteSquence:
<!-- Save INSTALLFOLDER parameter to CMDLINE_INSTALLFOLDER -->
<Custom Action='SaveCmdLineValue' Before='AppSearch' />
<!-- Set INSTALLFOLDER from SERVERINSTALLFOLDER without the \Server\ -->
<Custom Action="VBScriptInstallFolderFromFoundServer" After="AppSearch">
SERVERINSTALLFOLDER
</Custom>
<!-- Set INSTALLFOLDER from parameter CMDLINE_INSTALLFOLDER -->
<Custom Action='SetFromCmdLineValue' After='VBScriptInstallFolderFromFoundServer'>
CMDLINE_INSTALLFOLDER
</Custom>
服务器安装文件夹
CMDLINE\u安装文件夹
最后。。。在产品I中,我将其放在以下片段中:
<!-- Install to previous install path From parameter, OR from found installation OR from registry -->
<CustomActionRef Id='SaveCmdLineValue' />
<PropertyRef Id='INSTALLFOLDER'/><!-- include Fragment -->
<PropertyRef Id='SERVERINSTALLFOLDER'/><!-- include Fragment -->
<CustomActionRef Id='VBScriptInstallFolderFromFoundServer' /><!-- include Fragment -->