How To Verify .Net Framework Version
The .Net Framework is Microsoft promise of “compile once and run everywhere” programming approach. Conceptually, the .Net Framework is similar to Java “write once run everywhere (WORE)” language on JVM, where the interoperability programming feature being one of the vital functionality.
Since Microsoft introduces .Net Framework 1.0 as an optional upgrade on Nov 2000, the latest stable release of .Net Framework 4.0 has been the mandatory component of all Windows Vista and Windows Server 2008 (Longhorn) Operating systems!
How to identify, check, detect or verify the Microsoft .Net Framework version installed on a computer?
There are at least two ways to verify Microsoft .Net Framework version, by Internet Explorer User Agent String or by compiling a .Net program to read the Environment.Version property of System namespace.
Reading the Environment.Version property of System namespace.
If you’re keen on .Net programming, compile either one of these .Net program source code samples that retrieve Environment.Version property to identify .Net Framework version:
C# source code to identify .Net Framework version:
Save this C# source code as DotNetVer.cs and compile it with C# command line compiler, i.e. csc DotNetVer.cs
using System;class Version
{
public static void Main()
{
Console.WriteLine();
Console.WriteLine(“.Net Framework Version {0}”,
Environment.Version.ToString());
}
}
You can download this compiled program dotnetver.
Put it on c: and launch command dos line
dotnetver.exe
How to compile with c# via a batch file.
Create this batch file named csharp.bat on c:
cd C:WINDOWSMicrosoft.NETFrameworkv2.0.50727
csc /out:c:csharp%1.exe c:csharp%1.cs
cd
echo “Done …”
this script will take source code file from c:csharp like that :
c:csharp dotnetver (without .cs)
You can find from msdn C# compilations instructions
You can find from msdn VB.NET compilations instructions
Enjoy it …