3

I need to get the list of all framework versions that are installed in the computer, buy I need the full name, as it is in the Add/Remove programs. Like: "Microsoft .NET Framework 3.5 SP1" or "Microsoft .NET Framework 2.0 Service Pack 2"

is there any way to get that list (in Windows XP and 7)?

jpaugh
  • 6,634
  • 4
  • 38
  • 90
user2254436
  • 491
  • 3
  • 10
  • 24
  • 2
    [`How to: Determine Which .NET Framework Versions Are Installed`](http://msdn.microsoft.com/en-us/library/hh925568.aspx) – Soner Gönül Apr 10 '13 at 11:07
  • Just run the .NET redistributable from your setup by marking it as a prerequisite, please don't mess with .NET installations yourself ... anyway, what have you tried? Look at [this duplicate](http://stackoverflow.com/questions/951856/is-there-an-easy-way-to-check-net-framework-version-using-c). – CodeCaster Apr 10 '13 at 11:07

3 Answers3

2

You can get the framework versions including their names from the Windows Registery

See these links for reference:

Is there an easy way to check the .NET Framework version?

http://www.walkernews.net/2008/05/16/how-to-check-net-framework-version-installed/

Community
  • 1
  • 1
Ali
  • 1,409
  • 13
  • 23
2

Thank, I use those links to get my answer, this was waht I did:

        string path = @"SOFTWARE\Microsoft\NET Framework Setup\NDP";
        List<string> display_framwork_name = new List<string>();

        RegistryKey installed_versions = Registry.LocalMachine.OpenSubKey(path);
        string[] version_names = installed_versions.GetSubKeyNames();

        for (int i = 1; i <= version_names.Length - 1; i++)
        {
            string temp_name = "Microsoft .NET Framework " + version_names[i].ToString() + "  SP" + installed_versions.OpenSubKey(version_names[i]).GetValue("SP");
            display_framwork_name.Add(temp_name);
        }

        return display_framwork_name;

So my output was: "Microsoft .NET Framework v3.5 SP1" "Microsoft .NET Framework v3.0 SP2" and so on....

user2254436
  • 491
  • 3
  • 10
  • 24
1

You can use the command dotnet --list-sdks in the terminal to list all installed sdks.

https://learn.microsoft.com/en-us/dotnet/core/install/how-to-detect-installed-versions?pivots=os-windows

2.1.701 [C:\Program Files\dotnet\sdk]
3.0.100-preview5-011568 [C:\Program Files\dotnet\sdk]
5.0.401 [C:\Program Files\dotnet\sdk]
6.0.401 [C:\Program Files\dotnet\sdk]
7.0.100-preview.6.22352.1 [C:\Program Files\dotnet\sdk]
7.0.100-rc.1.22431.12 [C:\Program Files\dotnet\sdk]

The command dotnet --list-runtimes will list the installed runtimes.

DaemonFire
  • 573
  • 6
  • 13