NSIS installer that checks for .NET Framework

前端 未结 6 1989
忘了有多久
忘了有多久 2020-12-29 08:49

I want to create an NSIS installer that checks for the .NET Framework and installs it if it\'s not there. Can you point me to a script for this? I\'m very new to NSIS.

6条回答
  •  庸人自扰
    2020-12-29 09:43

    Try the DotNetVer script. It uses LogicLib and is quite easy to use.

    • HasDotNet checks if the specific version of .NET framework is installed. can be replaced with the following values: 1.0, 1.1, 2.0, 3.0, 3.5, 4.0.
    • AtLeastDotNetServicePack checks if the .NET framework has a service pack version at least as specified.
    • IsDotNetServicePack checks if the .NET framework has a service pack version exactly as specified.
    • HasDotNetClientProfile checks if the .NET framework is a client profiled install.
    • HasDotNetFullProfile checks if the .NET framework is a full install.

    Sample:

    ${If} ${HasDotNet4.0}
        DetailPrint "Microsoft .NET Framework 4.0 installed."
        ${If} ${DOTNETVER_4_0} AtLeastDotNetServicePack 1
            DetailPrint "Microsoft .NET Framework 4.0 is at least SP1."
        ${Else}
            DetailPrint "Microsoft .NET Framework 4.0 SP1 not installed."
        ${EndIf}
        ${If} ${DOTNETVER_4_0} HasDotNetClientProfile 1
            DetailPrint "Microsoft .NET Framework 4.0 (Client Profile) available."
        ${EndIf}
        ${If} ${DOTNETVER_4_0} HasDotNetFullProfile 1
            DetailPrint "Microsoft .NET Framework 4.0 (Full Profile) available."
        ${EndIf}
        ${If} ${DOTNETVER_4_0} HasDotNetFullProfile 0
            DetailPrint "Microsoft .NET Framework 4.0 (Full Profile) not available."
        ${EndIf}
    ${EndIf}
    

提交回复
热议问题