NSIS安装程序使用.NET 4.5 [英] NSIS Installer with .NET 4.5
本文介绍了NSIS安装程序使用.NET 4.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有些code片段后,我为NSIS检测并有条件地运行.NET 4.5的安装程序
I'm after some code snippets for NSIS to detect and conditionally run the .NET 4.5 installer
这答案 - NSIS安装程序与.NET 4.0 - 太幼稚如检查注册表项(不是值)只有presense 4.0和4.5之间不会歧视
This answer - NSIS Installer with .NET 4.0 - is too naive as checking only the presense of the registry key (not the value) will not discriminate between 4.0 and 4.5
推荐答案
您不应该检查一个确切的版本号。这将在未来的变化(如对于4.0> 4.5的情况下)。相反,使用C $ CS中的$从部署指南。
You shouldn't check for an exact version number. This will change in the future (as was the case for 4.0 > 4.5). Instead use the codes from the deployment guide.
另外,你应该尝试从.net 4.5处理重新启动。
In addition to that you should try to handle the reboot from .Net 4.5.
Function CheckAndInstallDotNet
; Magic numbers from http://msdn.microsoft.com/en-us/library/ee942965.aspx
ClearErrors
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "Release"
IfErrors NotDetected
${If} $0 >= 378389
DetailPrint "Microsoft .NET Framework 4.5 is installed ($0)"
${Else}
NotDetected:
DetailPrint "Installing Microsoft .NET Framework 4.5"
SetDetailsPrint listonly
ExecWait '"$INSTDIR\Tools\dotNetFx45_Full_setup.exe" /passive /norestart' $0
${If} $0 == 3010
${OrIf} $0 == 1641
DetailPrint "Microsoft .NET Framework 4.5 installer requested reboot"
SetRebootFlag true
${EndIf}
SetDetailsPrint lastused
DetailPrint "Microsoft .NET Framework 4.5 installer returned $0"
${EndIf}
FunctionEnd
这篇关于NSIS安装程序使用.NET 4.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文