How can I query .NET current version?

  • Thread starter Thread starter Peter Steele
  • Start date Start date
P

Peter Steele

Is there a registry entry that I can use to find the current active .NET
installation on a system? I know I can use this path

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\InstallRoot

to find the base install path. This gives me (on my system)

C:\WINDOWS\Microsoft.NET\Framework

But there doesn't seem to be any obvious key under this that I should use to
find the current .NET version to give me the complete path, e.g.,

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322

Is there a key with this information? I am making this query from an
unmanaged C++ app.
 
From a managed app, you can use "System.Environment.Version" property.
From an unmanaged app, i'm afraid you have no other solution than using
registry.

Lionel.
 
I realize I have to use the registry, that's what my post is about. I was
asking what specific registry entry I should query to obtain this
information?
 
My guess is that you can't.
I think that "current version" has no sense.
When you have both .NET Framework 1.0 and .NET Framework 1.1 installed, you
may have one app running with .NET Framework 1.0 and another app running
with .NET Framework 1.1.
You question is more about .NET Framework used in current process and I'm
afraid that you must use "System.Environment.Version" property (not
accessible from your unmanaged DLL :-( ) in this case.

Lionel.


Just for your information, this article explain how to detect wich versions
are installed:
http://support.microsoft.com/default.aspx?scid=kb;[LN];315291.
 
Back
Top