如何在Inno Setup中静默安装Microsoft VC ++可再发行组件?我使用了以下代码,除安装进度窗口外,大多数安装部分都是静默的。
以下是我的[Run]
部分代码: -
[Run]
Filename: "{app}\bin\vcredist_x86.exe"; \
Parameters: "/passive /verysilent /norestart /q:a /c:""VCREDI~3.EXE /q:a /c:""""msiexec /i vcredist.msi /qn"""" """; \
Check: VCRedistNeedsInstall; WorkingDir: {app}\bin;Flags: runminimized nowait; \
StatusMsg: Installing CRT...
答案 0 :(得分:5)
您可以将其添加到设置脚本中:
[Files]
Source: "vcredist_x86.exe"; DestDir: {tmp}; Flags: deleteafterinstall
[Run]
Filename: {tmp}\vcredist_x86.exe; \
Parameters: "/q /passive /Q:a /c:""msiexec /q /i vcredist.msi"""; \
StatusMsg: "Installing VC++ 2008 Redistributables..."
请注意,如果您使用的是与2008年不同的可再发行版本,则运行参数会略有变化。
答案 1 :(得分:3)
要顺利进行安装,请检查是否有必要安装可再发行组件。如果安装的版本已经是最新版本(很有可能),则甚至不要解压缩它。
[Files]
; VC++ redistributable runtime. Extracted by VC2017RedistNeedsInstall(), if needed.
Source: ".\Redist\VC_redist_2017.x64.exe"; DestDir: {tmp}; Flags: dontcopy
[Run]
Filename: "{tmp}\VC_redist_2017.x64.exe"; StatusMsg: "{cm:InstallingVC2017redist}"; Parameters: "/quiet"; Check: VC2017RedistNeedsInstall ; Flags: waituntilterminated
[Code]
function VC2017RedistNeedsInstall: Boolean;
var
Version: String;
begin
if (RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64', 'Version', Version)) then
begin
// Is the installed version at least 14.14 ?
Log('VC Redist Version check : found ' + Version);
Result := (CompareStr(Version, 'v14.14.26429.03')<0);
end
else
begin
// Not even an old version installed
Result := True;
end;
if (Result) then
begin
ExtractTemporaryFile('VC_redist_2017.x64.exe');
end;
end;
请注意,14.14可再发行版也适用于VS2015。
答案 2 :(得分:2)
我修改了上面的代码如下。然后我得到了它正常工作,整个安装非常顺利和安静。
[Run]
Filename: "{app}\bin\vcredist_x86.exe"; \
Parameters: "/q /norestart /q:a /c:""VCREDI~3.EXE /q:a /c:""""msiexec /i vcredist.msi /qn"""" """; \
Check: VCRedistNeedsInstall; WorkingDir: {app}\bin;
参考链接:
答案 3 :(得分:0)
这是我的解决方案:
Filename: "{tmp}\vc_redist.x86.exe"; Parameters: "/q /norestart"; \
Check: VCRedistNeedsInstall; StatusMsg: "Installing VC++ redistributables..."