************************************************************************ * wwUtils :: IsDotNet **************************************** *** Function: Returns whether .Net is installed *** Optionally returns the framework path and version *** of the highest installed version. *** *** Both parameters should be passed by ref ************************************************************************ FUNCTION IsDotNet(lcFrameworkPath,lcVersion) LOCAL x lcFrameworkPath = SPACE(256) DECLARE INTEGER GetWindowsDirectory ; IN Win32API ; STRING @pszSysPath,; INTEGER cchSysPath lnsize=GetWindowsDirectory(@lcFrameworkPath,256) if lnSize > 0 lcFrameworkPath = SUBSTR(lcFrameworkPath,1,lnSize) + "\" ELSE lcFrameworkPath = TRIM(lcFrameworkPath) ENDIF *** Assume .NET 2.0 lcVersion = "v2.0.50727" *** Try to find the largest version number lcFrameworkPath = lcFrameworkPath + "Microsoft.NET\Framework\" lnCount = ADIR(laNetDirs,lcFrameworkPath + "v?.*.*","D") IF lnCount < 1 lcVersion = "" lcFrameworkPath = "" RETURN .F. ENDIF *** Highest version comes last so go backwards through list FOR x = lnCount TO 1 STEP -1 lcVersion = laNetDirs[x,1] lcTPath = ADDBS(lcFrameworkPath + lcVersion ) IF FILE(lcTPath + "regasm.exe") lcFrameworkPath = ADDBS(lcTPath) EXIT ENDIF ENDFOR RETURN .T. ENDFUNC * wwUtils :: IsDotNetcall with something like this:
lcVersion = "" lcPath = "" llIsAvailable = IsDotnet(@lcPath, @lcVersion) ? lcPath && C:\Windows\Microsoft.NET\Frameworkv4.0.30319\ ? lcVersion && v4.0.30319If you need to find all the versions you can just loop through the directories and collect them into an array.