Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Allowing VFP to determine installed .NET Frameworks
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Installation et configuration
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP3
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01590916
Message ID:
01591409
Vues:
55
Thanks for the help, Rick !

>Best way to check is by looking at the installed folders in the .NET Framework directory in Windows. If you're accessing this from FoxPro, you'll only be interested in the 32 bit version.
>
>Here's what I use to figure out the highest version installed:
>
>
>************************************************************************
>* 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 :: IsDotNet
>
>
>call with something like this:
>
>
>lcVersion = ""
>lcPath = ""
>llIsAvailable = IsDotnet(@lcPath, @lcVersion)
>
>? lcPath  && C:\Windows\Microsoft.NET\Frameworkv4.0.30319\
>? lcVersion && v4.0.30319 
>
>
>If you need to find all the versions you can just loop through the directories and collect them into an array.
>
>This comes from wwUtils.prg - if you use any West Wind tool this will be part of the standard library.
>
>+++ Rick ---
>
>>Hi Gang!
>>
>>Do you have any code that allows Visual Foxpro 9.0 to determine what version of the .NET framework you have installed on the customers PC ??
>>
>>(This is so I can then install the correct version of the Framework for some utility programs we must now install - dependant on the required Framework.)
>>
>>Thanks
>>Tommy
Tommy Tillman A+ NetWork+ MCP
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform