| SemVerAnalyzer | SemVerAnalyzer.Abstractions |
|---|---|
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.
This is published as a dotnet tool. To install:
dotnet tool install SemVerAnalyzerThe 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.jsonsettingsruleOverrides- Provides overrides for individual rules (see below).
nugetrepositoryUrl- The URL to the Nuget feed where the existing assembly is published. Mutually exclusive withpackageSource.packageSource- The name of the Nuget package source where the existing assembly is published. Mutually exclusive withrepositoryUrl.
- Major (breaking changes)
AbstractMethodIsNotOverrideableRuleAbstractPropertyIsNotOverrideableRuleAbstractEventIsNotOverrideableRuleEnumMemberRemovedRuleEnumMemberValueChangedRuleEventOnInterfaceAddedRuleEventRemovedRuleMethodOnInterfaceAddedRuleMethodRemovedRuleNonAbstractMethodHasBecomeAbstractRuleNonAbstractPropertyHasBecomeAbstractRuleNonAbstractEventHasBecomeAbstractRulePropertyGetterRemovedRulePropertyOnInterfaceAddedRulePropertyOnInterfaceGetterAddedRulePropertyOnInterfaceSetterAddedRulePropertyRemovedRulePropertySetterRemovedRuleProtectedPropertyGetterNotAccessibleRuleProtectedPropertySetterNotAccessibleRulePublicPropertyGetterNotPublicRulePublicPropertySetterNotPublicRuleReferencesMajorBumpedRuleTypeRemovedRuleVirtualMethodHasBeenSealedRuleVirtualPropertyHasBeenSealedRuleVirtualEventHasBeenSealedRuleVirtualMethodIsNotVirtualRuleVirtualPropertyIsNotVirtualRuleVirtualEventIsNotVirtualRule
- Minor (non-breaking additions)
EnumMemberAddedRuleEventOnConcreteTypeAddedRuleInaccessiblePropertyGetterIsNowProtectedRuleInaccessiblePropertyGetterIsNowPublicRuleInaccessiblePropertySetterIsNowProtectedRuleInaccessiblePropertySetterIsNowPublicRuleMethodOnConcreteTypeAddedRulePropertyOnConcreteTypeAddedRulePropertyOnConcreteTypeGetterAddedRulePropertyOnConcreteTypeSetterAddedRuleReferencesMinorBumpedRuleTypeAddedRuleTypeMarkedObsoleteRule
- Patch
ReferencesPatchBumpedRuleVirtualMethodHasBeenOverriddenRuleVirtualPropertyHasBeenOverriddenRuleVirtualEventHasBeenOverriddenRuleVirtualMethodIsNoLongerOverriddenRuleVirtualPropertyIsNoLongerOverriddenRuleVirtualEventIsNoLongerOverriddenRule
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
AssemblyDefTypeDefPropertyDefMethodDefEventDef
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.
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
IgnoreMajorMinorPatch
Ignore will prevent the rule from running, while this others will recategorize the rules as configured.