DotNetVersionFinder 2.1.1

dotnet add package DotNetVersionFinder --version 2.1.1                
NuGet\Install-Package DotNetVersionFinder -Version 2.1.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DotNetVersionFinder" Version="2.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotNetVersionFinder --version 2.1.1                
#r "nuget: DotNetVersionFinder, 2.1.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DotNetVersionFinder as a Cake Addin
#addin nuget:?package=DotNetVersionFinder&version=2.1.1

// Install DotNetVersionFinder as a Cake Tool
#tool nuget:?package=DotNetVersionFinder&version=2.1.1                

DotNetVersionFinder

Provides functionality to find the highest version of .NET that is installed on a system. Supports both .NET Framework (4.5 onwards) and newer .NET versions (.NET Core 1-3, and then .NET 5 onwards).

Quickstart

  1. Install the package from NuGet
  2. Call DotNetVersion.GetVersion()
  3. You're done!

Alternatively, if you want to be more specific as to which .NET version you're getting, you can use: DotNetVersion.GetDotNetCliVersion() or DotNetVersion.GetFrameworkVersion(). Also, for power users, you can get the release key from the registry using DotNetVersion.GetFrameworkReleaseKey().

Supported .NET verions

  • .NET via the dotnet CLI. Supports all versions of .NET from 5 onwards.
  • .NET Core via the dotnet CLI. Supports all versions of .NET core.
  • .NET Framework via the registry. Supports .NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1.

This library doesn't currently support .NET Framework versions 1.0 through to 4.0, as they are no longer supported by Microsoft, and they add additional complexity to the code. However, if there is enough demand I will gladly add support. Pull requests are welcome.

Release notes

2.1.0

  • Use --list-runtimes rather than --version when determining version via the dotnet CLI. This gives the runtime version rather than the SDK version, which is more correct for our usage.

2.0.0

  • Overhaul API.
  • Add support for .NET 5+
  • Add support for .NET Core 1-3
  • Add support for .NET Framework 4.8.1

1.1.3

  • Add support for .NET Framework 4.8.

1.1.2

  • Add support for undocumented release keys.

1.1.0

  • Add support for retrieving the current .NET Framework release key via DotNetVersion.FindReleaseKey().

1.0.1

  • Add support for .NET Framework 4.7.2.

1.0.0

  • Initial release.

Installation

Just grab it from NuGet

PM> Install-Package DotNetVersionFinder

Copyright (c) Matthew King. Distributed under the MIT License. Refer to license.txt for more information.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.5

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.1 1,940 11/28/2022
2.1.0 338 11/18/2022
2.0.0 330 11/15/2022
1.1.3 5,206 4/19/2019
1.1.2 599 4/18/2019
1.1.1 596 4/18/2019
1.1.0 851 10/9/2018
1.0.1 1,056 5/1/2018
1.0.0 1,015 5/1/2018