A similar question was asked here, but it was specific to .NET 3.5. Specifically, I'm looking for the following:
- What is the correct way to determine which .NET Framework versions and service packs are installed?
- Is there a list of registry keys that can be used?
- Are there any dependencies between Framework versions?
There is a GUI tool available, ASoft .NET Version Detector, which has always proven highly reliable. It can create XML files by specifying the file name of the XML output on the command line.
You could use this for automation. It is a tiny program, written in a non-.NET dependent language and does not require installation.
For a 64-bit OS, the path would be:
Here is a PowerShell script to obtain installed .NET framework versions
It was written based on How to: Determine Which .NET Framework Versions Are Installed. Please use THE Get-FrameworkVersion() function to get information about installed .NET framework versions.
In Windows 7 (it should work for Windows 8 also, but I haven't tested it):
Go to a command prompt
Steps to go to a command prompt:
In cmd, type this command
This gives the latest version of NET Framework installed.
One can also try Raymond.cc Utilties for the same.
Using the Signum.Utilities library from SignumFramework (which you can use stand-alone), you can get it nicely and without dealing with the registry by yourself:
There is an official Microsoft answer to this question at the following knowledge base article:
Article ID: 318785 - Last Review: November 7, 2008 - Revision: 20.1 How to determine which versions of the .NET Framework are installed and whether service packs have been applied
Unfortunately, it doesn't appear to work, because the mscorlib.dll version in the 2.0 directory has a 2.0 version, and there is no mscorlib.dll version in either the 3.0 or 3.5 directories even though 3.5 SP1 is installed ... why would the official Microsoft answer be so misinformed?