The result in Windows Server 2003 R2 is alwaysExch $R0 ; Set R0 has "v2.0" in it
Push $R1
Push $R2
;This next line prints OK
DetailPrint "Searching for Microsoft.net $R0"
; set R1 to minor version number of the installed .NET runtime
EnumRegValue $R1 HKLM \
"Software\Microsoft\.NetFramework\policy\$R0" 0
IfErrors getdotnetdir_err
DetailPrint "Searching for Microsoft.net $R0 build $R1"
; set R2 to .NET install dir root
ReadRegStr $R2 HKLM \
"Software\Microsoft\.NetFramework" "InstallRoot"
IfErrors getdotnetdir_err
DetailPrint "Root folder found: $R2"
DetailPrint "Found folder: $R2$R0.$R1"
; set R0 to the .NET install dir full
StrCpy $R0 "$R2$R0.$R1"
getdotnetdir_end:
Pop $R2
Pop $R1
Exch $R0 ; return .net install dir full
Return
getdotnetdir_err:
DetailPrint "Where were we? $R2$R0.$R1"
StrCpy $R0 ""
Goto getdotnetdir_end
"Searching for Microsoft.net v2.0
Where were we? 1v2.0.50727"
So it seems like EnumRegValue returns an error in spite of also returnin the correct key name ("50727").
I changed it to this, in order to get it working:
DO you have any idea why this behaviour?
; set R1 to minor version number of the installed .NET runtime
EnumRegValue $R1 HKLM \
"Software\Microsoft\.NetFramework\policy\$R0" 0
StrCmp $R1 "" getdotnetdir_err
DetailPrint "Searching for Microsoft.net $R0 build $R1"
ClearErrors
Thanks for your help.
Joel