13

What are the different ways (programmatically and otherwise) to determine what versions of .NET are running on a system?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Krishna Kumar
  • 4,834
  • 13
  • 46
  • 46
  • Possible duplicate of *[How to detect what .NET Framework versions and service packs are installed?](http://stackoverflow.com/questions/199080/how-to-detect-what-net-framework-versions-and-service-packs-are-installed)*. – Peter Mortensen Jul 22 '15 at 15:41
  • The canonical question is *[How to detect what .NET Framework versions and service packs are installed?](http://stackoverflow.com/questions/199080)*. – Peter Mortensen Jul 22 '15 at 15:42

6 Answers6

8

Directly from the source:

How to determine which versions and service pack levels of the Microsoft .NET Framework are installed

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Torlack
  • 4,395
  • 1
  • 23
  • 24
  • 1
    Very complicated answer and thread by Torlack. The trick given by Ryan below is straight forward and simple – Jasmine Feb 11 '13 at 05:35
3

If you're wanting the current framework version in use then you can see that via:

System.Environment.Version
Ryan Farley
  • 11,315
  • 4
  • 46
  • 43
2

I found How to check .NET Framework version installed much more usable. Essentially, open Internet Explorer, and paste this into the address bar:

javascript:alert(navigator.userAgent)

I don't know if it always works, or if it is complete, but it works for my uses, doesn't require a lot of extra reading, and works without installing anything additional.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

Get the smallest .NET Framework download possible that will tell you based on the headers you are sending. It only works on Internet Explorer or if you have the Firefox extension installed. More info in Hanselman's blog post.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Darren Kopp
  • 76,581
  • 9
  • 79
  • 93
0

If you're using IIS6 and above, open up IIS and click on Web Service Extensions. It will list each framework installed. Granted, .NET 3.0 and 3.5 are both based on the 2.0 framework.

chrisofspades
  • 847
  • 1
  • 10
  • 16
0

It's not necessarily running I would say. Since you can have .NET 1.1, 2.0, 3.0 and 3.5 installed on the same machine and they can run perfectly side-by-side. Meaning one of your app can be running on top of 1.1 and another web application is running on 2.0.

In IIS (for web app), this is quite easy, just go to the property of the virtual directory / application and go to the ASP.NET tab, you should see what version of .NET you are actually using (or rather, what version of ASP.NET which is pretty much tied into the .NET Framework version).

ps. just remember, you can only run 1 version of .NET Framework per application pool in IIS. So if you try to use the same application pool to run different versions of the framework, you're in for a surprise. Solution is to just create a framework version specific application pool (i.e. one pool for all 1.1 framework and another for 2.0 framework)

Jimmy Chandra
  • 6,472
  • 4
  • 26
  • 38