cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ajay_vish
Level 2

Is() function does not work properly for detecting Dot Net framework 2.0

Hello,
I was writing a function to detect the .net framework and the service pack level installed on the computer. I am using the code below to check the .net framework 2.0 and its service pack level.

//Check .net Framework 2.0, 2.0_SP1, 2.0_SP2
if (Is(DOTNETFRAMEWORKINSTALLED, REGDB_KEYPATH_DOTNET_20)) then
szMaxVersion = "2.0.0.0";
if (Is(DOTNETSERVICEPACKINSTALLED, "1|" + REGDB_KEYPATH_DOTNET_20)) then
nMaxSP = 1;
endif;
if (Is(DOTNETSERVICEPACKINSTALLED, "2|" + REGDB_KEYPATH_DOTNET_20)) then
nMaxSP = 2;
endif;
endif;

My computer has .net f/w 2.0 with SP2 installed (see attachment) but
when I debug the code both the checks for service pack passes. Please help.
Am I doing something wrong?
Labels (1)
0 Kudos
(1) Reply
Shuttledude
Level 7

It might be the structure of your if-then-endif statements.

I got this similar code to work, separated into two separate if-then-endif statements:


if (Is(DOTNETFRAMEWORKINSTALLED, REGDB_KEYPATH_DOTNET_20)) then
MessageBox("dotnet 20 installed", MB_OK);
endif;

if (Is(DOTNETSERVICEPACKINSTALLED, "1|" + REGDB_KEYPATH_DOTNET_20)) then
MessageBox(dotnet 20 SP1 installed", MB_OK);
endif;
0 Kudos