vb如何在inno-setup编译器中添加.NET框架设置(可供未来所有需要它的应用程序使用)



我一直在使用"如何安装.NET Framework;s尚未安装?解决方案成功,但当我尝试运行另一个新应用程序(来自调试的.exe)时,该应用程序需要与上一个应用程序的安装程序安装的.NET framework版本相同的.NET framework,系统会给我错误:"找不到运行此应用程序的运行时版本"。

对我来说,这意味着新应用程序无法使用已安装的.NET框架,需要安装"自己的".NET

否则,我必须为我的新应用程序进行设置,以便在目标机器没有.NET时安装它。但这次我希望以一种可以供未来应用程序使用的方式来安装。我该怎么做?

这是.Net安装的示例。它假定本地.Net安装程序可能存在于同一目录中。

[Code]
function InitializeSetup: Boolean;
var
ErrorCode: Integer;
Result1 : Boolean;
begin
try
ExpandConstant('{dotnet20}');
Result := True;
except
begin
Result1 := MsgBox('NOTE: Some modules of this software require Microsoft .NET Framework. Would you like to install the .NET Framework now?', mbConfirmation, MB_YESNO) = idYes;
if Result1 = false then
begin
Result:=True;
end
else
begin
if not ShellExec('open', ExpandConstant('{src}dotnetfx.exe'),'', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode) then
begin
if not ShellExec('open', ExpandConstant('{src}dotnetfx3.exe'),'', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode) then
begin
if not ShellExec('open', ExpandConstant('{src}dotnetfx3setup.exe'),'', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode) then
begin
ShellExec('open', 'http://www.microsoft.com/en-us/download/details.aspx?id=17851','', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode)
end
end
end;
Result:=False;
end;
end;
end;
end;

相关内容

最新更新