How To Check .Net Framework Version Installed
Microsoft .Net 3.5 framework is in RTM version since Nov 2007. While not every Windows machines require .Net framework to run, but sooner or later you may find some programs failed because of no such framework installed or otherwise the latest .Net 3.5 framework is not found.
In this case, you might wonder what .Net framework version you have or do you have the so-called latest .Net 3.5 framework?
OK, general end users can use either one of these ways to check the .Net framework version:
If you’re programmer who is going to develop a simple .Net framework version verifier, here are two options, but only second option seems to be better:
P/S: To direct download the latest .Net framework 3.5 full package (197 MB), you may find it at Microsoft Download Center, or just click here to direct download from genuine Microsoft server.

OK, general end users can use either one of these ways to check the .Net framework version:
- Query the User Agent String of Internet Explorer web browser. This is the easier way, I think, as every Windows bundled with IE! Although you need to remember this simple, one line JavaScript:
javascript:alert(navigator.userAgent)
Copy and paste that line of JavaScript code to IE Address bar and press ENTER key, you will see a pop-up dialog box with similar content as this:

As shown, the IE 7 User Agent String shows my Windows Vista (Windows NT 6.0) has installed .Net 2.0 (.Net CLR 2.0.50727), .Net 3.0 (.Net CLR 3.0.04506) as well as the latest .Net 3.5 framework (.Net CLR 3.5.21022).
Please take note that that JavaScript code can be used in Firefox or Opera web browser to query their User Agent String too (but only the IE will report .Net framework version in its User Agent String).
- Navigate to this Windows Registry path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP
The major version number of each .Net framework releases installed can be found at this Registry path. Click the major version number key and there is a string value called “version” on the right-pane that reports the full version number of that .Net framework:

- Navigate to the Registry path that keeps the IE User Agent String:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform
If you think this Registry key path is easier to remember than the shorter, one-line JavaScript code that query the User Agent String, then this could be your answer.
- For those who have installed the latest .Net framework SDK, any of the .Net compilers report the .Net framework version at Command Prompt window as well.
For example, enter this C# command line compilercscat Command Prompt window shows a similar header message as this:

If you’re programmer who is going to develop a simple .Net framework version verifier, here are two options, but only second option seems to be better:
- Environment.Version property of .Net framework. For example, this simple C# source code can be compiled to a .Net console program that shows .Net framework version installed:
using System; class Version { public static void Main() { Console.WriteLine(); Console.WriteLine(".Net Framework Version {0}", Environment.Version.ToString()); } }
You don’t have to install Visual Studio except the .Net framework SDK (which package all the .Net command line compilers, including the C# compiler). Thus, to compile the C# code in a source file called sample.cs with C# command line compiler, just enter this at Command Prompt:
csc sample.cs - Limitation of Environment.Version property – only one of the multiple .Net framework versions installed will be reported. I.e. if you’ve .Net 2.0, .Net 3.0 and .Net 3.5 version installed, Environment.Version reports only .Net 2.0 framework.
To overcome this problem, Aaron Stebner’s .Net version checker source code is better choice, where the programming approach is to query the Windows Registry keys and also call the mscoree.dll exported APIs to report the presence of all .NET Framework versions.
Aaron Stebner .Net version checker source code
Download the .Net version checker source code and compile the code with Visual Studio 2005 or Visual C++ 2005 Express edition, with the present of .Net framework 2.0 SDK or mscoree.h from that version of the SDK.
P/S: To direct download the latest .Net framework 3.5 full package (197 MB), you may find it at Microsoft Download Center, or just click here to direct download from genuine Microsoft server.
Custom Search







2010 •
Hi,
This is shazif,
can any one tell me how to check programatically the .Net installation using C# please….
For C# , Environment.Version gave me 2.0.50727.1434 though I have 3.5 installed and my express VS 2008 compiles my application as a 3.5 .NET application.
I think that is the reason why the Application asks for 2.0 .NET install when getting it installed in a system without any .NET framework.
Moreover it crashes in a system that has 2.0 but does not have 3.5. I would like to know how I can fix this.
I wanted to test for 3.5 .NET installation with the Environment.Version check and exit application if system has no 3.5 .NET. But that doesn’t seem to be possible either.
-Regmee
The below shows all the .NET Framework versions installed in a box.
class Program
{
const string regLocation=”SOFTWARE\\Microsoft\\NET Framework Setup\\NDP”;
static void Main(string[] args)
{
Console.WriteLine(“.NET Framework versions installed”);
Console.WriteLine(“———————————”);
Console.WriteLine();
RegistryKey masterKey = Registry.LocalMachine.OpenSubKey(regLocation);
RegistryKey tempKey;
if (masterKey == null)
{
Console.WriteLine(“Null Key!”);
}
else
{
string[] SubKeyNames = masterKey.GetSubKeyNames();
for (int i = 0; i < SubKeyNames.Length; i++)
{
tempKey = Registry.LocalMachine.OpenSubKey(regLocation + “\\” + SubKeyNames[i]);
Console.Write(SubKeyNames[i]);
Console.WriteLine(“\tVersion = {0}”, tempKey.GetValue(“Version”));
}
}
Console.ReadKey();
}
} //end class
Hi Marios,
I got to that point. But that won’t solve my problem. I won’t be able to execute that piece of code written in .NET 3.5 in a machine that has no .NET framework, or just has .NET 2.0 installed.
If you go back to my previous comment, my problem is, for my 3.5 application , a system without .NET is asking me to install 2.0 and in a system that already has 2.0 – the application crashes.
I won’t be able to create an installer that could possibly help me check that because my application is an Skype add-on and has to be published with Skype Publishing Studios that takes my binaries and makes a .sparc installer.
any thought ??
-regmee
Hi Marios Koumides, thank you for sharing this block of code.
To readers:
If you find Aaron Stebner’s .Net version checker source code (C++.net) is “too complex”, Marios’s C# code could be your choice.
Aaron Stebner vs Marios Koumides:
Aaron Stebner (cf “Limitation of Environment.Version property” section at above)
1) Written in C++.net
2) Reading both Registry key value and mscoree.dll exported APIs to report the presence of all .NET Framework versions.
Marios Koumides
1) Written in C#
2) Reading only Registry key value
Notes to Marios Koumides’s source code:
1) You need to insert two namespaces before
class program:2) If you copy and paste the block of code, you might need to replace most of the typographic double-quotation marks to typewriter double-quotation marks, i.e. change
“to"Microsoft have an alternative method:
http://support.microsoft.com/kb/318785
Yep, saves a lot of time !
Many thanks.
Just a small comment in windows server the CSC.exe is located in
C:\WINDOWS\Microsoft.NET\Framework\ ( VER that is installed )
Many thanks.
Just a small comment in windows server the CSC.exe is located in
C:\WINDOWS\Microsoft.NET\Framework\ ( VER that is installed )
Upgrades will be installed in program files.
Note about IE method when using javascript:alert(navigator.userAgent): Javascript doesn’t execute if IE is displaying blank page (about:blank in address bar). Open any web page, including other about pages like about:Tabs.
@Tbone, thanks heaps!