Hi Ian, I need to test the client has the correct framework installed. I
use something like this: (turn heads Tuple-haters)
|public static boolHasDotNetFrameworkMatching(decimal targetVersion, int
targetServicePack)
{
foreach (Tuple<decimal, int> versionin 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: ozdotnet-boun...@ozdotnet.com
[mailto:ozdotnet-boun...@ozdotnet.com] 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 <il.tho...@iinet.net.au>
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
>
>