简体   繁体   English

Windows XP上的NSIS .NET4.5安装程序

[英]NSIS .NET4.5 Installer on Windows XP

All, I have the following NSIS function that checks for .NET4.5+ and if it is not installed the web installer is launched (if there is an internet connection) and the installation proceeds once .NET4.5 has been installed. 所有,我都有以下NSIS功能,用于检查.NET4.5 +,如果尚未安装,则将启动Web安装程序(如果存在Internet连接),并且在安装.NET4.5后继续进行安装。 This works fine for Windows 7 and 8, but it is not working correctly for Windows XP. 这对于Windows 7和8可以正常工作,但是对于Windows XP则无法正常工作。 The function is 该功能是

Function CheckAndInstallDotNet
    ; Installer dotNetFx45_Full_setup.exe avalible from http://msdn.microsoft.com/en-us/library/5a4x27ek.aspx
    ; 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 >= 378181 ;378389
        DetailPrint "Microsoft .NET Framework 4.5 is installed ($0)"
    ${Else}
    NotDetected:
        MessageBox MB_YESNO|MB_ICONQUESTION ".NET Framework 4.5+ is required for UserCost2013, \
            do you want to launch the web installer? This requires a valid internet connection." IDYES InstallDotNet IDNO Cancel 
        Cancel:
            MessageBox MB_ICONEXCLAMATION "To install UserCost2013, Microsoft's .NET Framework v${DOT_MAJOR}.${DOT_MINOR} \
                (or higher) must be installed. Cannot proceed with the installation!"
            ${OpenURL} "${WWW_MS_DOTNET4_5}"
            RMDir /r "$INSTDIR" 
            SetOutPath "$PROGRAMFILES"
            RMDir "$INSTDIR" 
            Abort

        ; Install .NET4.5.
        InstallDotNet:
            DetailPrint "Installing Microsoft .NET Framework 4.5"
            SetDetailsPrint listonly
            ExecWait '"$INSTDIR\dotNETFramework\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}

    ; Now remove the dotNETFramework directory and contents.
    RMDir /r "$INSTDIR\dotNETFramework" 
    ;Delete "$INSTDIR\dotNETFramework\dotNetFx45_Full_setup.exe"
    ;RMDir "$INSTDIR\dotNETFramework" 
FunctionEnd

The problem is with ExecWait , it executes the web-installer 'dotNetFx45_Full_setup.exe' and unpacks the required temporary files. 问题在于ExecWait ,它执行网络安装程序'dotNetFx45_Full_setup.exe'并解压缩所需的临时文件。 Then, when in the Win7/8 case it launches the installer, in XP it does not. 然后,在Win7 / 8中启动安装程序,而在XP中则不启动。 instead it proceeds to install my application without .NET being installed. 相反,它将继续安装我的应用程序而未安装.NET。 Needless to say this is causing issues for XP users. 不用说这给XP用户造成了问题。

How can I get this function working properly in XP? 如何使此功能在XP中正常工作?

Thanks for your time. 谢谢你的时间。

.NET4.5 is not supported on Windows XP, which is why the installer exits without doing anything. Windows XP不支持.NET4.5,这就是为什么安装程序不执行任何操作而退出的原因。

http://channel9.msdn.com/Forums/Coffeehouse/Why-is-XP-Support-for-NET-45-not-happening http://channel9.msdn.com/Forums/Coffeehouse/Why-is-XP-Support-for-NET-45-not-happening

.NET 4.5 RC Framework CLR - Windows XP compatibility .NET 4.5 RC Framework CLR-Windows XP兼容性

...and many other StackOverflow questions. ...以及其他许多StackOverflow问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM