user2254436
user2254436

Reputation: 543

Get full list of .NET framework version installed

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)?

Upvotes: 7

Views: 19481

Answers (3)

DaemonFire
DaemonFire

Reputation: 873

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.

Upvotes: 6

user2254436
user2254436

Reputation: 543

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....

Upvotes: 3

Ali
Ali

Reputation: 1409

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/

Upvotes: 2

Related Questions