SemVerAnalyzer 3.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global SemVerAnalyzer --version 3.0.1                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local SemVerAnalyzer --version 3.0.1                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=SemVerAnalyzer&version=3.0.1                
nuke :add-package SemVerAnalyzer --version 3.0.1                

build test

SemVerAnalyzer SemVerAnalyzer.Abstractions
Nuget Version Nuget Version
Nuget Download Count Nuget Download Count

Semantic Versioning Analyzer

This tool compares two versions of the same assembly (one local and one from a Nuget feed), lists the changes to the public API, and suggests an appropriate Semantic Versioning increment.

By default, it compares the local assembly to a published assembly of the same name on Nuget.org.

Usage

This is published as a dotnet tool. To install:

dotnet tool install SemVerAnalyzer

The command line options are as follows:

  -a, --assembly            Required. The built assembly to test.

  -o, --outputPath          The output file path for the report.

  -c, --config              Required. Path to the configuration file.

  -r, --additional-rules    A path to a single assembly or folder of assemblies which contain additional
                            rules.  Overrides `additionalRules` setting in JSON configuration file.

  -p, --package-name        If the package name is different than the DLL file name, specify it here.

  --omit-disclaimer         Omits the disclaimer paragraph that appears at the top of the output.

  -h, --include-header      Includes a header with the assembly and package at the top of the output.

  --help                    Display this help screen.

  --version                 Display version information.

The dotnet command for the tool is analyze-semver. For example,

dotnet analyze-semver -a path/to/MyAssembly.dll -o results.txt -c ./config.json

Configuration

  • settings
    • ruleOverrides - Provides overrides for individual rules (see below).
  • nuget
    • repositoryUrl - The URL to the Nuget feed where the existing assembly is published.

Built-in Rules

  • Major (breaking changes)
    • AbstractMethodIsNotOverrideableRule
    • AbstractPropertyIsNotOverrideableRule
    • AbstractEventIsNotOverrideableRule
    • EnumMemberRemovedRule
    • EnumMemberValueChangedRule
    • EventOnInterfaceAddedRule
    • EventRemovedRule
    • MethodOnInterfaceAddedRule
    • MethodRemovedRule
    • NonAbstractMethodHasBecomeAbstractRule
    • NonAbstractPropertyHasBecomeAbstractRule
    • NonAbstractEventHasBecomeAbstractRule
    • PropertyGetterRemovedRule
    • PropertyOnInterfaceAddedRule
    • PropertyOnInterfaceGetterAddedRule
    • PropertyOnInterfaceSetterAddedRule
    • PropertyRemovedRule
    • PropertySetterRemovedRule
    • ProtectedPropertyGetterNotAccessibleRule
    • ProtectedPropertySetterNotAccessibleRule
    • PublicPropertyGetterNotPublicRule
    • PublicPropertySetterNotPublicRule
    • ReferencesMajorBumpedRule
    • TypeRemovedRule
    • VirtualMethodHasBeenSealedRule
    • VirtualPropertyHasBeenSealedRule
    • VirtualEventHasBeenSealedRule
    • VirtualMethodIsNotVirtualRule
    • VirtualPropertyIsNotVirtualRule
    • VirtualEventIsNotVirtualRule
  • Minor (non-breaking additions)
    • EnumMemberAddedRule
    • EventOnConcreteTypeAddedRule
    • InaccessiblePropertyGetterIsNowProtectedRule
    • InaccessiblePropertyGetterIsNowPublicRule
    • InaccessiblePropertySetterIsNowProtectedRule
    • InaccessiblePropertySetterIsNowPublicRule
    • MethodOnConcreteTypeAddedRule
    • PropertyOnConcreteTypeAddedRule
    • PropertyOnConcreteTypeGetterAddedRule
    • PropertyOnConcreteTypeSetterAddedRule
    • ReferencesMinorBumpedRule
    • TypeAddedRule
    • TypeMarkedObsoleteRule
  • Patch
    • ReferencesPatchBumpedRule
    • VirtualMethodHasBeenOverriddenRule
    • VirtualPropertyHasBeenOverriddenRule
    • VirtualEventHasBeenOverriddenRule
    • VirtualMethodIsNoLongerOverriddenRule
    • VirtualPropertyIsNoLongerOverriddenRule
    • VirtualEventIsNoLongerOverriddenRule

Custom Rules

The -r / --additional-rules command switch takes a path to a single assembly or a folder that contains assemblies where additional rules are defined. This can also be set in by the settings.additionalRules configuration setting. The command line switch will override the configuration setting.

A rule is an implementation of IVersionAnalysisRule<T> where T is one of

  • AssemblyDef
  • TypeDef
  • PropertyDef
  • MethodDef
  • EventDef

as defined by the dnlib library. The interface is defined in a separate Nuget package, SemVerAnalyzer.Abstractions, for this purpose.

To help with output, there are also a number of extension methods on the pertinent dnlib types that can generate C#-formatted names for members.

Overriding Rule Severity

The built-in rules are defined with severities as listed above. However, this can be overridden via the settings.ruleOverrides configuration setting.

The value for this setting is an object whose keys are rule names and values are one of

  • Ignore
  • Major
  • Minor
  • Patch

Ignore will prevent the rule from running, while this others will recategorize the rules as configured.

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 was computed.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
4.0.1 371 4/19/2024
4.0.0 203 4/15/2024
3.0.1 606 3/7/2024
3.0.0 458 3/7/2024
2.3.0 2,703 10/21/2021
2.2.0 2,399 5/4/2021
2.1.1 2,237 3/9/2021
2.1.0 2,029 3/5/2021
2.0.0 2,286 1/12/2021
1.4.0 2,256 12/7/2020
1.3.0 1,951 12/6/2020
1.2.2 2,271 11/21/2020
1.2.1 2,148 11/21/2020
1.2.0 2,050 11/21/2020
1.1.1 2,147 11/18/2020
1.0.0 2,178 11/17/2020
0.1.2 2,227 11/12/2020
0.1.1 2,251 11/12/2020
0.1.0 2,186 11/12/2020