Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to best retrieve installed .NET Desktop Runtime versions?

I need to determine programmatically (c#) if a certain .NET Desktop Runtime version is installed on the system.

One option that I found was to check the version in the registry like this post suggests. However, this will only retrieve the latest version installed. With ASP.NET Core versions can for example be found in the registry here: SOFTWARE\Microsoft\ASP.NET Core\Shared Framework

System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription; Will only retrieve the version of the framework the application is running on.

The official way seems to be using the command "dotnet --list-runtimes" (documented by Microsoft here). This will require that a cmd process is started from the application.

Is there another possible way of retrieving the currently installed .NET Desktop Runtime versions?

like image 600
Sebastian Avatar asked Sep 05 '25 03:09

Sebastian


1 Answers

Not a great way but you can check if .NET install folders exist in the system. For .net runtime the install folder is -

C:\program files\dotnet\shared{runtime-type}{version}\

like image 169
pankaj Avatar answered Sep 07 '25 23:09

pankaj