Inno setup 如何安装VisualC++可重分配包2015?

Inno setup 如何安装VisualC++可重分配包2015?,inno-setup,vcredist,Inno Setup,Vcredist,我有这样一句话: [Files] Source: "vc_redist.x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall [Run] Filename: {tmp}\vc_redist.x64.exe; Parameters: "/install /passive /norestart"; StatusMsg: Installing VC++ 2015 Redistributables... Filename: "{app}\{#MyA

我有这样一句话:

[Files]
Source: "vc_redist.x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall

[Run]
Filename: {tmp}\vc_redist.x64.exe; Parameters: "/install /passive /norestart"; 
 StatusMsg: Installing VC++ 2015 Redistributables...
Filename: "{app}\{#MyAppExeName}"; 
 Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; 
 Flags: nowait postinstall skipifsilent
但有点问题,因为它从未安装vc_redist.64.exe

编辑:这是日志

[21:25:22,783]   *** Setup started
[21:25:29,299]   Setup version: Inno Setup version 5.5.9 (a)
[21:25:29,300]   Original Setup EXE: C:\Users\Justo\Desktop\pruebas\ANdi.exe
[21:25:29,301]   Setup command line: /SL5="$200EAA,183958979,53760,C:\Users\Justo\Desktop\pruebas\ANdi.exe" /SPAWNWND=$300F00 /NOTIFYWND=$170EEE /DEBUGWND=$1B60C36 
[21:25:29,302]   Windows version: 10.0.14393  (NT platform: Yes)
[21:25:29,303]   64-bit Windows: Yes
[21:25:29,304]   Processor architecture: x64
[21:25:29,305]   User privileges: Administrative
[21:25:29,307]   64-bit install mode: No
[21:25:34,891]   Created temporary directory: C:\Users\Justo\AppData\Local\Temp\is-GVDUU.tmp
[21:25:44,315]   Starting the installation process.
[21:25:44,319]   Creating directory: C:\Program Files (x86)\ANdi
[21:25:44,321]   Directory for uninstall files: C:\Program Files (x86)\ANdi
[21:25:44,322]   Creating new uninstall log: C:\Program Files (x86)\ANdi\unins000.dat

[21:25:44,327]   -- File entry --
[21:25:44,329]   Dest filename: C:\Program Files (x86)\ANdi\unins000.exe
[21:25:44,332]   Time stamp of our file: 2016-12-26 21:25:29.248
[21:25:44,334]   Installing the file.
[21:25:44,337]   Uninstaller requires administrator: Yes
[21:25:44,462]   Successfully installed the file.

[21:25:44,471]   -- File entry --
[21:25:44,473]   Dest filename: C:\Program Files (x86)\ANdi\ANDI.exe
[21:25:44,475]   Time stamp of our file: 2016-12-23 15:54:56.000
[21:25:44,476]   Installing the file.
[21:25:50,568]   Successfully installed the file.

[21:25:50,578]   -- File entry --
[21:25:50,580]   Dest filename: C:\Program Files (x86)\ANdi\JPLEPH.exe
[21:25:50,582]   Time stamp of our file: 2016-11-03 20:07:04.000
[21:25:50,584]   Installing the file.
[21:25:50,605]   Successfully installed the file.

[21:25:50,616]   -- File entry --
[21:25:50,618]   Dest filename: C:\Program Files (x86)\ANdi\JPLEPH.430
[21:25:50,620]   Time stamp of our file: 2016-10-14 12:42:00.000
[21:25:50,621]   Installing the file.
[21:26:00,566]   Successfully installed the file.

[21:26:00,575]   -- File entry --
[21:26:00,577]   Dest filename: C:\WINDOWS\Fonts\astro.ttf
[21:26:00,585]   Time stamp of our file: 1996-09-03 03:00:00.000
[21:26:00,587]   Dest file exists.
[21:26:00,588]   Skipping due to "onlyifdoesntexist" flag.

[21:26:00,600]   -- File entry --
[21:26:00,602]   Dest filename: C:\Users\Justo\AppData\Local\Temp\is-
GVDUU.tmp\vc_redist.x64.exe
[21:26:00,604]   Time stamp of our file: 2016-12-26 18:52:40.000
[21:26:00,605]   Installing the file.
[21:26:02,005]   Successfully installed the file.

[21:26:02,014]   -- Icon entry --
[21:26:02,016]   Dest filename: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\ANdi.lnk
[21:26:02,018]   Creating the icon.
[21:26:02,048]   Successfully created the icon.

[21:26:02,057]   -- Icon entry --
[21:26:02,059]   Dest filename: C:\Users\Public\Desktop\ANdi.lnk
[21:26:02,061]   Creating the icon.
[21:26:02,073]   Successfully created the icon.
[21:26:02,087]   Installation process succeeded.

[21:26:02,099]   -- Run entry --
[21:26:02,100]   Run as: Current user
[21:26:02,102]   Type: Exec
[21:26:02,103]   Filename: C:\Users\Justo\AppData\Local\Temp\is-GVDUU.tmp\vc_redist.x64.exe
[21:26:02,105]   Parameters: /install /passive /norestart
[21:26:02,857]   Process exit code: 1638
[21:26:02,860]   Need to restart Windows? No

[21:26:05,117]   -- Run entry --
[21:26:05,119]   Run as: Original user
[21:26:05,121]   Type: Exec
[21:26:05,122]   Filename: C:\Program Files (x86)\ANdi\ANDI.exe
[21:26:05,388]   Deinitializing Setup.
[21:26:05,430]   *** Setup exit code: 0

你能帮我吗?非常感谢。

我很感激现在回答得太晚了,但这篇文章有很多观点,所以我希望这些信息对其他人有所帮助。关键部分是DoVcredistInstall函数及其在Inno安装步骤中的使用

以下是我使用的Inno安装脚本的一些片段:-

函数dovcreditinstall:整数; 变量 结果代码:整数; strResultCode:字符串; 开始 记录“DoVcredistInstall内部”; 结果代码:=0; NeedRestartFlag:=False; 如果RegKeyExistsHKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7e9fae12-5bbf-47fb-b944-09c49e75c061},则 开始 记录“REDIST已安装”; 终止 其他的 开始 ProgressPage:=CreateOutputProgressPage“Microsoft可再发行文件检查”; ProgressPage.Show; 提取临时文件'VC_redist.x86.exe'; ExecExpandConstant'{tmp}\VC_redist.x86.exe','/q/norestart',SW_SHOW,ewwaituntiltereded,ResultCode; strResultCode:=IntToStrResultCode; 进行页面隐藏; 终止 日志'vcredit RETURN CODE='+strResultCode; 结果:=结果代码; 终止 {应用程序是否正在运行检查} 函数IsAppRunningFileName:string:Boolean; 变量 FSWbemLocator:变体; FWMIService:变体; FWbemObjectSet:变量; 开始 结果:=假; FSWbemLocator:=CreateOleObject'WBEMScripting.SWBEMLocator'; FWMIService:=FSWbemLocator.ConnectServer,'root\CIMV2'; FWbemObjectSet:=FWMIService.ExecQueryFormat‘从Win32_进程中选择名称,其中名称=%s’,[FileName]; 结果:=FWbemObjectSet.Count>0; FWbemObjectSet:=未分配; FWMIService:=未分配; FSWbemLocator:=未分配; 如果结果=真,则 开始 msgBox“应用程序已运行错误”,MB信息,MB_正常; 终止 终止 {查找打开的指定窗口} 函数MyFindWindowData:字符串:布尔值; 变量 hWND:整数; 开始 hWND:=FindWindowByWindowNameWindowData; 如果hWND>0,则 开始 MsgBox“应用程序窗口打开错误”,MB信息,MB_OK; 结果:=真; 终止 终止 过程CurStepChangedCurStep:TSetupStep; 变量 VcredistResultCode:整数; strvCreDistributResultCode:字符串; 开始 如果CurStep=ssInstall,则 开始 NeedRestartFlag:=False; VcredistResultCode:=DoVcredistInstall; strVcredistResultCode:=“CurStepChanged VcredistResultCode=”+IntToStrVcredistResultCode; LogsTrvCreDistributResultCode; 如果VcredistResultCode=1641或VcredistResultCode=3010,则{需要运行时安装重新启动,1641=由vcredist启动的重新启动,3010=成功,但需要重新启动} 开始 NeedRestartFlag:=True; 终止 其他的 开始 如果VcredistResultCode 0和VcredistResultCode 1638,则{运行时安装失败0=成功,1638=已安装新版本,其他任何内容=失败} 开始 MsgBox'Install error='+strvCreDistriseSultCode',MB信息,MB_OK; 中止{abort} 终止 终止 终止 终止 函数:布尔型; 开始 如果需要重新启动标志,则 开始 日志“需要重新启动”; 结果:=真; 终止 其他的 开始 日志“不需要重新启动”; 结果:=假; 终止 终止 这将检查运行时的一个特定版本,因此您可能必须更改关键数据以反映您的版本。我的数据来自:

VC可再发行文件的错误1638表示已安装此产品的另一个版本。为了确认这一点,我会用标准方式非沉默、非被动地给安装程序打电话。