tags:

views:

253

answers:

5

How do I find out which version of .NET is installed?

I'm looking for something as simple as "java -version" that I can type at the command prompt and that tells me the current version(s) installed.

EDIT: I better add that Visual Studio may not be installed - this is typically something that I want to know about a client machine.

+4  A: 

Just type any one of the below commands to give you the latest version in the first line

1. CSC
2. GACUTIL /l ?
3. dir /b /ad /o-n %systemroot%\Microsoft.NET\Framework\v?.*

You can only run the first two from Visual Studio Command prompt if you have Visual Studio Installed, or else if you have .NET framework SDK then SDK Command prompt.
Last command will list out all the versions of .NET installed, latest first.

Binoj Antony
'csc' is not recognized as an internal or external command
sepang
Matt Lacey
ok, then I need to add that visual studio is not installed :-)
sepang
+2  A: 

Check similar question which is answered.

http://stackoverflow.com/questions/520631/checking-if-net-is-installed-from-the-command-line

shivaspk
Well, why go through all that trouble when you can do it in one simple command.
Binoj Antony
@shivaspk: You should add also following directories: \v3.0\. \v3.5\. \v4.0.20506\.
Rubens Farias
+1  A: 

For the version of the framework that is installed, it varies depending on which service packs and hotfixes you have installed. Take a look at this MSDN page for more details. It suggests looking in %systemroot%\Microsoft.NET\Framework to get the version.

Environment.Version will programmatically give you the version of the CLR.

Note that this is the version of the CLR, and not necessarily the same as the latest version of the framework you have installed (.Net 3.0 and 3.5 both use v2 of the CLR).

adrianbanks
+2  A: 

.NET Version Detector is a GUI utility that display which of the 6(!) versions of the framework are installed.

Phil Devaney
Thank you, I guess that is the best suggestion so far.
sepang
+1  A: 

If you open a command prompt and type the following two commands:

 >cd %systemroot%\Microsoft.NET\Framework

 >dir /A:D

All framework versions that are installed on the current machine will be listed (each one is stored in a separate directory within this directory).

m_arnell