How can I query .NET current version?

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.
 
L

Lionel LASKE

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.
 
P

Peter Steele

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?
 
L

Lionel LASKE

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top