
/ If it needs to filter to Windows Desktop versions only (WPF/Winforms). Public class DotNetRuntimeVersionDetector / Class that can determine if a version of. I make no guarantees it works or will work in the future License: Do whatever you want with this. It uses the CliWrap nuget package you could probably do without it, but I already used it in my project, as it makes command line handling easier for my needs. I made a small file in C# that parses the output of dotnet.exe -list-runtimes which could be pretty easily adapted to fit your needs. I came here looking for a programmatic way to determine this while this question has many good answers, none of them seem programmatic. On one of my servers running Windows Server 2016 with Windows Server Hosting pack (no SDK) result is as follows. SDK is 2.1.2 and runtime is 2.0.3.NET Command Line Tools (2.1.2)īase Path: C:\Program Files\dotnet\sdk\2.1.2\ On my development machine (Windows 10) the result is as follows. NET Core is installed you will get some response. I just wanted to point out (at least for NET.Core 2.0 and above) the only thing needed is to execute dotnet -info in a command prompt to get information about the latest version installed. I work primarily with Windows development machines and servers. It will list down the folder with installed version name. On Ubuntu or Alpine: ls /usr/share/dotnet/shared// DISCLAIMER: This no longer works, but may work for older versions.ĭotnet -version Latest SDK version DISCLAIMER: Apparently the result of this may be affected by any global.json config files. In addition, you can see the latest Runtime and SDK versions installed by issuing these commands at the command prompt:ĭotnet Latest Runtime version is the first thing listed. (Source for the locations: A developer's blog)

Open C:\Program Files\dotnet\sdk in Windows Explorer Open C:\Program Files\dotnet\shared\ in Windows Explorer NET Core Download Archive to help you decipher the SDK versions.Įverything below this point is old information, which is less relevant, but may still be useful. I'm on Windows, but I'd guess that would work on Mac or Linux as well with a current version.Īlso, you can reference the. If you only want to see installed runtimes: dotnet -list-runtimes

If you only want to see the SDKs: dotnet -list-sdks

It will print out the installed runtimes and SDKs, as well as some other info: I'm not sure when it was added, but the info command now includes this information in its output. net core versions" command, but there's hope. Great question, and the answer is not a simple one.
