缺少netframework运行环境解决方法(netframework3.0怎么安装)

根据网上前人判断.net版本改加入windows版本判断而来。已测试通过!;脚本由InnoSetup脚本向导生成!;有关创建InnoSetup脚本文件的详细资料请查阅帮助文档![Code]//.netframework安装检

根据网上前人判断.net版本改加入windows版本判断而来。已测试通过!

; 脚本由 Inno Setup 脚本向导 生成!; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档!

[Code] //.net framework安装检查 —— 判断指定的.NET Framework版本及service pack是否已经安装// 函数参数说明:// 参数1:version — 指定待判断的.NET Framework版本【下面列举了对应关系】:// ‘v1.1’ .NET Framework 1.1// ‘v2.0’ .NET Framework 2.0// ‘v3.0’ .NET Framework 3.0// ‘v3.5’ .NET Framework 3.5// ‘v4\\Client’ .NET Framework 4.0 Client Profile// ‘v4\\Full’ .NET Framework 4.0 Full Installation// ‘v4.5’ .NET Framework 4.5// ‘v4.5.1’ .NET Framework 4.5.1// ‘v4.5.2’ .NET Framework 4.5.2// ‘v4.6’ .NET Framework 4.6// ‘v4.6.1’ .NET Framework 4.6.1// ‘v4.6.2’ .NET Framework 4.6.2// ‘v4.7’ .NET Framework 4.7// ‘v4.7.1’ .NET Framework 4.7.1// ‘v4.7.2’ .NET Framework 4.7.2// `v4.8` .NET Framework 4.8//// 参数2:service — 指定待判断的service pack版本:// 0 No service packs required// 1, 2, etc. Service pack 1, 2, etc. requiredfunction IsDotNetDetected(version: string; service: cardinal): boolean;var key, versionKey: string; install, release, serviceCount, versionRelease: cardinal; success: boolean;begin versionKey := version; versionRelease := 0; // .NET 1.1 and 2.0 embed release number in version key if version = ‘v1.1’ then begin versionKey := ‘v1.1.4322’; end else if version = ‘v2.0’ then begin versionKey := ‘v2.0.50727’; end // .NET 4.5 and newer install as update to .NET 4.0 Full else if Pos(‘v4.’, version) = 1 then begin versionKey := ‘v4\\Full’; case version of ‘v4.5’: versionRelease := 378389; ‘v4.5.1’: versionRelease := 378675; // 378758 on Windows 8 and older ‘v4.5.2’: versionRelease := 379893; ‘v4.6’: versionRelease := 393295; // 393297 on Windows 8.1 and older ‘v4.6.1’: versionRelease := 394254; // 394271 before Win10 November Update ‘v4.6.2’: versionRelease := 394802; // 394806 before Win10 Anniversary Update ‘v4.7’: versionRelease := 460798; // 460805 before Win10 Creators Update ‘v4.7.1’: versionRelease := 461308; // 461310 before Win10 Fall Creators Update ‘v4.7.2’: versionRelease := 461808; // 461814 before Win10 April 2018 Update ‘v4.8’: versionRelease := 528040; end; end; // installation key group for all .NET versions key := ‘SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\’ + versionKey; // .NET 3.0 uses value InstallSuccess in subkey Setup if Pos(‘v3.0’, version) = 1 then begin success := RegQueryDWordValue(HKLM, key + ‘\\Setup’, ‘InstallSuccess’, install); end else begin success := RegQueryDWordValue(HKLM, key, ‘Install’, install); end; // .NET 4.0 and newer use value Servicing instead of SP if Pos(‘v4’, version) = 1 then begin success := success and RegQueryDWordValue(HKLM, key, ‘Servicing’, serviceCount); end else begin success := success and RegQueryDWordValue(HKLM, key, ‘SP’, serviceCount); end; // .NET 4.5 and newer use additional value Release if versionRelease > 0 then begin success := success and RegQueryDWordValue(HKLM, key, ‘Release’, release); success := success and (release >= versionRelease); end; result := success and (install = 1) and (serviceCount >= service);end;//判断windows版本function MyGetWindowsVersion: String; // 获取 Windows 版本varVersion: TWindowsVersion;beginGetWindowsVersionEx(Version);// Windows7if (Version.Major = 6) and (Version.Minor = 0) thenbeginResult := ‘VISTA’;Exit;end;// Windows7if (Version.Major = 6) and (Version.Minor = 1) thenbeginResult := ‘WIN7’;Exit;end;// Windows XP if (Version.Major = 5) and (Version.Minor >=1) thenbeginResult := ‘WINXP’;Exit;end;// Windows 8 if (Version.Major = 6) and (Version.Minor >1) thenbeginResult := ‘WIN8’;Exit;end;// Windows 10if (Version.Major = 10) thenbeginResult := ‘WIN10′;Exit;end; end; // 根据不同windows版本,判断所需的.netframework版本 function InitializeSetup: Boolean; var Path:string; ResultCode: Integer; Version: TWindowsVersion; begin GetWindowsVersionEx(Version); if (MyGetWindowsVersion=’XP’ ) then //或者 (Version.Major = 5) begin if IsDotNetDetected(‘v4’, 0) then begin Result := true; End Else begin if MsgBox(‘系统检测到您没有安装.Net Framework 4 版本,是否立刻下载并安装?’, mbConfirmation, MB_YESNO) = idYes then begin Path := ExpandConstant(‘{pf}/Internet Explorer/iexplore.exe’); Exec(Path, ‘
http://download.microsoft.com/download/1/B/E/1BE39E79-7E39-46A3-96FF-047F95396215/dotNetFx40_Full_setup.exe’, ”, SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode); MsgBox(‘请安装好.Net Framework环境后(4.0client-4.0Full),再运行本安装包程序!’,mbInformation,MB_OK); Result := false; Exit; End Else begin MsgBox(‘没有安装.Net Framework环境,无法运行程序,本安装程序即将退出!’,mbInformation,MB_OK); Result := false; Exit; end; end; end else begin Result := true; End; if (MyGetWindowsVersion=’WIN7′ ) OR (MyGetWindowsVersion=’VISTA’ ) OR (MyGetWindowsVersion=’WIN8′ ) then //或者 (Version.Major = 6) begin if IsDotNetDetected(‘v4.5’, 0) or IsDotNetDetected(‘v4.5.1’, 0) or IsDotNetDetected(‘v4.5.2’, 0) or IsDotNetDetected(‘v4.6’, 0) or IsDotNetDetected(‘v4.6.1’, 0) or IsDotNetDetected(‘v4.6.2’, 0) or IsDotNetDetected(‘v4.7’, 0) or IsDotNetDetected(‘v4.7.1’, 0) or IsDotNetDetected(‘v4.7.2’, 0) then begin Result := true; End Else begin if MsgBox(‘系统检测到您没有安装.Net Framework 4.5-4.7.2版本,是否立刻下载并安装?’, mbConfirmation, MB_YESNO) = idYes then begin Path := ExpandConstant(‘{pf}/Internet Explorer/iexplore.exe’); //4.5.2 Exec(Path, ‘http://download.microsoft.com/download/B/4/1/B4119C11-0423-477B-80EE-7A474314B347/NDP452-KB2901954-Web.exe’, ”, SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode); MsgBox(‘请安装好.Net Framework环境后(4.5-4.7.2),再运行本安装包程序!’,mbInformation,MB_OK); Result := false; Exit; End Else begin MsgBox(‘没有安装.Net Framework环境,无法运行程序,本安装程序即将退出!’,mbInformation,MB_OK); Result := false; Exit; end; end; end else begin Result := true; End; if (MyGetWindowsVersion=’10’ ) then //或者 (Version.Major = 10) begin if IsDotNetDetected(‘v4.6.1’, 0) or IsDotNetDetected(‘v4.6.2’, 0) or IsDotNetDetected(‘v4.7’, 0) or IsDotNetDetected(‘v4.7.1’, 0) or IsDotNetDetected(‘v4.7.2’, 0) then begin Result := true; End Else begin if MsgBox(‘系统检测到您没有安装.Net Framework 4.6.1-4.8版本,是否立刻下载并安装?’, mbConfirmation, MB_YESNO) = idYes then begin Path := ExpandConstant(‘{pf}/Internet Explorer/iexplore.exe’); //4.6.2 Exec(Path, ‘http://download.microsoft.com/download/D/5/C/D5C98AB0-35CC-45D9-9BA5-B18256BA2AE6/NDP462-KB3151802-Web.exe’, ”, SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode); MsgBox(‘请安装好.Net Framework环境后(4.6.1-4.8),再运行本安装包程序!’,mbInformation,MB_OK); Result := false; Exit; End Else begin MsgBox(‘没有安装.Net Framework环境,无法运行程序,本安装程序即将退出!’,mbInformation,MB_OK); Result := false; Exit; end; end; end else begin Result := true; End; end;

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,请发送邮件至 55@qq.com 举报,一经查实,本站将立刻删除。转转请注明出处:https://www.szhjjp.com/n/31177.html

(0)
nan
上一篇 2021-09-28
下一篇 2021-09-28

相关推荐

  • 电力吃紧多地启动限电(东北部分商铺点蜡烛营业)

    “大清早停水停电,家里一滴水没有,马桶都冲不了”“手机没有信号,完全上不了网”“家里没电做不了饭,下楼发现,都是找饭的人”……最近不少东北地区网友反映家里停电,“东北限电”的消息也登上微博热搜,引发广泛关注。东北地区之外,其他地方亦传出“限电”消息

    2021-09-28 随笔
    0
  • 小米手机质保多久(小米手机突然没有声音了怎么回事)

    保质期指的是食物的最佳食用期限,每种食物都有不同的保质期,小米有没有保质期,他的保质期又是多少呢,比如放了两三年的小米,还能吃吗?小米,是谷子去皮后的产物,小米的营养价值很高,含丰富的蛋白质、脂肪和维生素,它不仅供食用,还有清热、清渴,滋阴,补脾肾和

    2021-10-14
    0
  • 小众好听的姓氏(哪些姓好听)

    一、龙姓源流古老涉及上古神话传说,象征着高贵的身体地位,这个姓氏一眼就令人难忘。二、风姓这个姓氏很有仙侠气息,中国上古三皇五帝之首伏羲氏的父亲燧人氏就是风姓。用这个姓氏起名字既好听又飘逸。三、蓝姓蓝是大海的颜色,这样的名字总代有一股悠远的宁静。取名更…

    2022-01-17
    0
  • 新品线上推广案例赏析(产品线上推广方案怎么做)

    最关键的要素就是有效流量,有效流量就是找到会购买你的产品、持续使用你产品、分享你产品的人。那如何才能获得有效流量呢?具体操作的时候可以分为五个步骤:用户调查内容制作寻找投放渠道数据回收内容调优这五个步骤的核心思维和具体操作方法:(

    2021-11-30 随笔
    0
  • 曾国藩家训最经典四句(曾国藩家书原文及翻译)

    好的家风是什么样子呢?我觉得,是成年后忆起童年,只觉心下欢喜、如沐春风,每一帧回忆,都让人觉得幸福,让人觉得没有辜负光阴,让人心生满满的自豪感。小时候,我是依偎在奶奶身旁的留守儿童,小小年纪的我,不满十岁就学会了洗衣做饭,打扫卫生,甚至

    2021-11-28 随笔
    0
  • 安徽有什么山景点介绍(安徽有哪些山)

    作为国内旅游资源,较为丰富的省份之一安徽,地处于华东地区,徽派文化的发源地,优越地理的环境,独特的自然景观,造就了安徽优美的风光,其中,我们耳熟能详的黄山,地藏菩萨道场的九华山,以及古时南岳的天柱山,使得成为安徽的旅游胜地,旅游景观的名片,也是安徽的…

    2022-01-17 随笔
    0

发表回复

登录后才能评论