-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Programmatically way to detect installed .NET Core version #3393
Description
Is there any reliable way to programmatically detect if .NET Core is installed on a computer (Windows only) and get the installed version? I'm aware of most guides say we can run dotnet --version or even worser dotnet --info in command line. However this is more related for a human sitting in front of a computer and wants to see the version and for this purpose only its okay. But it's not a good way to get the version programmatically. We would have to run cmd silently and then parse string ourselves and the string output might change in the future. Also if dotnet core isn't installed at all, the command fails completely.
For determining .NET Framework there is a reliable way via registry https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed where we don't have to run any hidden windows and we don't have to parse text. Can we have something like this for .NET Core too please?