SemVerAnalyzer 4.0.1

dotnet tool install --global SemVerAnalyzer --version 4.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 4.0.1                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=SemVerAnalyzer&version=4.0.1                
nuke :add-package SemVerAnalyzer --version 4.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.

  -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.

  --assume-changes          Assumes that something changed, making Patch the lowest bump rather than None. Default is
                            false.

  --show-changes            Show all changes, even if the version is as expected. Default is false.

  -f, --framework           Indicates the framework from the Nuget package to use as a comparison.

  --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. Mutually exclusive with packageSource.
    • packageSource - The name of the Nuget package source where the existing assembly is published. Mutually exclusive with repositoryUrl.

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 384 4/19/2024
4.0.0 203 4/15/2024
3.0.1 607 3/7/2024
3.0.0 458 3/7/2024
2.3.0 2,704 10/21/2021
2.2.0 2,400 5/4/2021
2.1.1 2,238 3/9/2021
2.1.0 2,029 3/5/2021
2.0.0 2,287 1/12/2021
1.4.0 2,257 12/7/2020
1.3.0 1,952 12/6/2020
1.2.2 2,272 11/21/2020
1.2.1 2,148 11/21/2020
1.2.0 2,052 11/21/2020
1.1.1 2,148 11/18/2020
1.0.0 2,179 11/17/2020
0.1.2 2,230 11/12/2020
0.1.1 2,251 11/12/2020
0.1.0 2,186 11/12/2020