【发布时间】:2023-02-24 05:13:18
【问题描述】:
我需要在 QT c++ 编写的任何其他自定义操作之前检查 C:\Windows\System32\vcruntime*.dll 是否存在。
<CustomAction Id="prechecksystem" Script="vbscript" Execute="deferred" Return="check">
<![CDATA[
Dim fso, sys32
Set fso = CreateObject("Scripting.FileSystemObject")
'0:WindowsFolder, 1:SystemFolder, 2:TemporaryFolder'
Set sys32 = fso.GetSpecialFolder(1)
If fso.FileExists(sys32 & "\vcruntime140.dll") Then
Session.Property("HSRSUPPORTVCRUNTIME") = "true"
End If
]]>
</CustomAction>
<Property Id="HSRSUPPORTVCRUNTIME" Value="false" />
<InstallUISequence>
<Custom Action="prechecksystem" After="CostFinalize"></Custom>
<Show Dialog="VcruntimeNotSupportWarning" Sequence="501"> <![CDATA[ ( HSRSUPPORTVCRUNTIME="false" ) ]]> </Show>
...
<InstallUISequence/>
但是 msiexec 说变量 HSRSUPPORTVCRUNTIME 没有定义?
【问题讨论】:
-
您不需要自定义操作来执行此操作,绝对不应该使用 VBScript。使用 FileSesrch。
-
FileSesrch 有效,谢谢!
标签: wix