Wal -that's good, but iirc tuples require 4.0
_____ Ian Thomas Victoria Park, Western Australia _____ From: [email protected] [mailto:[email protected]] On Behalf Of Wallace Turner Sent: Thursday, June 16, 2011 6:47 PM To: ozDotNet Subject: Re: Installed CLR versions Hi Ian, I need to test the client has the correct framework installed. I use something like this: (turn heads Tuple-haters) public static bool HasDotNetFrameworkMatching(decimal targetVersion, int targetServicePack) { foreach (Tuple<decimal, int> version in GetNETFrameworks()) { decimal framework = version.First; decimal servicePack = version.Second; if (framework == targetVersion && servicePack == targetServicePack) return true; } return false; } If you want the rest of the code then email me direct. On 16/06/2011 5:17 PM, Ian Thomas wrote: Thanks for suggestions. It's probably as simple to check the framework folders installed on the machine (and to test that each has some valid files and is not empty), as to try to interpret the registry subkeys. I can't find a good explanation (eg, the CDF subkey - what's that?). The stackoverflow article is a bit cross-purpose (and I had investigated that way anyway). The system.environment.version() of course gives the CLR version under which the test assembly was compiled (and will fail, perhaps ? - need to test this - if the running machine doesn't have CLR 4 installed). I guess the safe way is to check via the Windows Installer and my installation, but I haven't checked recently whether a custom action is available to test for installed CLR or .NET Frameworks up to 4.0 (I did see some post about the NSIS installer being way out of date with its detection). clrver.exe is very nice - it gives the PID, assembly name, and CLR version for each currently running assembly on the machine. But it's not a redistributable. Interestingly, explorer.exe (Windows Explorer shell) runs using CLR v4.0.30319 on my test machine. ________________________________ Ian Thomas Victoria Park, Western Australia -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of DotNet Dude Sent: Thursday, June 16, 2011 3:13 PM To: ozDotNet Subject: Re: Installed CLR versions Maybe check the registry: HKLM\Software\Microsoft\Net Framework Setup\NDP On Thu, Jun 16, 2011 at 4:54 PM, Ian Thomas <mailto:[email protected]> <[email protected]> wrote: > Apart from the utility clrver.exe (and the latest, v4.0.30319.1 is needed to > report both 2.0 and 4.0), how can I determined the installed versions of the > CLR on a machine? > > I can't discover a .NET function to report this. > ________________________________ > Ian Thomas > Victoria Park, Western Australia > >
