Get .NET Service Pack

From NSIS Wiki
Jump to navigationJump to search
Author: pixolut (talk, contrib)


This function retrieves the service pack of the .NET runtime library installed on the user's computer. It can be modified to detect specifiec .NET installations, but I would recommend using this function instead Get .NET Version. The function will return -1 if the entry is not found and 0 for a framework installation with NO service packs applied.

Refer for this article for more information [1]

The Function

;***************************************************************
;Returns the service pack of .Net 1.1 (simply chage the regkey to get 1.0 or 2.0
;Returns -1 if there is no .Net entry (not there or incorrect/incomplete install)
Function GetDotNETServicePack
  Push $R0
    ReadRegDWORD $R0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322" "SP"
   IfErrors 0 lbl_ok
   Strcpy $R0 "-1"
 lbl_ok:
  Exch $R0
FunctionEnd