Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
V

versionize

> 开发工具
Open source

Automatic versioning and CHANGELOG generation, with semver and conventional commits for dotnet

377 stars0 likes3 views
WebsiteGitHub

About

Automatic versioning and CHANGELOG generation, with semver and conventional commits for dotnet

Versionize

stop using weird build scripts to increment your nuget's version, use versionize!

Automatic versioning and CHANGELOG generation, using conventional commit messages.

how it works:

  1. when you land commits on your main branch, select the Squash and Merge option (not required).
  2. add a title and body that follows the Conventional Commits Specification.
  3. when you're ready to release a nuget package:
    1. git checkout main; git pull origin main
    2. run versionize
    3. git push --follow-tags origin main
    4. dotnet pack
    5. dotnet nuget push

versionize does the following:

  1. bumps the version in your .csproj file (based on your commit history)
  2. uses conventional-changelog to update CHANGELOG.md
  3. commits .csproj file and CHANGELOG.md
  4. tags a new release

Installation

bash
dotnet tool install --global Versionize

Usage

…

Example:

bash
versionize --workingDir ./src init --single

Supported commit types

Every commit should be in the form [optional scope]: for example fix(parser): remove colon from type and scope

  • fix - will trigger a patch version increment in the next release
  • feat - will trigger a minor version increment in the next release
  • all other types - you can use any commit type but that commit type will not trigger a version increment in the next release

Breaking changes must contain a line prefixed with BREAKING CHANGE: to allow versionize recognizing a breaking change. Breaking changes can use any commit type.

Example

bash
git commit -m "chore: update dependencies" -m "BREAKING CHANGE: this will likely break the interface"

Custom Commit Header Patterns

versionize supports custom commit header patterns for parsing commit messages. This is particularly useful when your team uses commit messages that differ from the conventional commits format.

To configure custom header patterns, create a .versionize file in your working directory with the following structure:

json
{
  "CommitParser": {
    "HeaderPatterns": [
      "^Merged PR \\d+: (?\\w*)(?:\\((?.*)\\))?(?!)?: (?.*)$",
      "^Pull Request \\d+: (?\\w*)(?:\\((?.*)\\))?(?!)?: (?.*)$"
    ]
  }
}

Example

If your team commits include messages like the following:

  • Merged PR 123: fix(squash-azure-case): subject text #64
  • Pull Request 11792: feat(azure-case): subject text

You can use the above configuration to ensure these commit messages are parsed correctly. versionize will extract the relevant type, scope, and subject information to include them in the changelog and determine version increments.

The happy versioning walkthrough

Preparation

Create a new project with the dotnet cli

bash
mkdir SomeProject
dotnet new classlib

Ensure that a <Version> element is contained in file SomeProject.csproj

xml

  
    1.0.0
  

Using versionize

Now let's start committing and releasing

bash
git init
...make some changes to "Class1.cs"
git add *
git commit -a -m "chore: initial commit"

versionize

Will add a CHANGELOG.md, add git tags and commit everything. Note that the version in SomeProject.csproj will not change since this is your first release with versionize.

bash
...make some changes to "Class1.cs"
git commit -a -m "fix: something went wrong we need a bugfix release"

versionize

Will update CHANGELOG.md, add git tags and commit everything. Note that the version in SomeProject.csproj is now 1.0.1.

bash
...make some changes to "Class1.cs"
git commit -a -m "feat: something really awesome coming in the next release"

versionize

Will update CHANGELOG.md, add git tags and commit everything. Note that the version in SomeProject.csproj is now 1.1.0.

bash
...make some changes to "Class1.cs"
git commit -a -m "feat: a really cool new feature" -m "BREAKING CHANGE: the API will break. sorry"

versionize

Will update CHANGELOG.md, add git tags and commit everything. Note that the version in SomeProject.csproj is now 2.0.0 since versionize detected a breaking change since the commit note BREAKING CHANGE was used above.

Bumping Alternative Version Elements

In some scenarios, you may want to bump a different version element instead of the standard `` element in your project files. This can be useful when you want to track file versions independently from package versions, or when working with specific version properties.

To use this feature, ensure your project file contains the desired version element (e.g., or):

xml

  
    1.0.0
  

Configure this in your .versionize file as part of the project configuration:

json
{
  "projects": [
    {
      "name": "MyProject",
      "path": ".",
      "versionElement": "FileVersion"
    }
  ]
}

For single-project repositories (non-monorepos), you can also configure it at the root level:

json
{
  "projects": [
    {
      "path": ".",
      "versionElement": "FileVersion"
    }
  ]
}

When this option is specified, versionize will:

  • Look for and bump the specified element (e.g., ) instead of
  • Still create git tags and update the changelog as normal
  • Use the specified element for determining the current and next version

Supported values include Version (default), FileVersion, AssemblyVersion, or any custom property name. Only alphanumeric and underscore characters are allowed.

Pre-releases

Versionize supports creating pre-release versions by using the --pre-release flag with a pre-release label, for example alpha.

The following workflow illustrates how pre-release workflows with versionize work.

bash
> git commit -a -m "chore: initial commit"
> versionize
// Generates version v1.0.0

> git commit -a -m "feat: some feature"
> versionize --pre-release alpha
// Generates version v1.1.0-alpha.0

> git commit -a -m "feat: some additional feature"
> versionize --pre-release alpha
// Generates version v1.1.0-alpha.1

> git commit -a -m "feat: some breaking feature" -m "BREAKING CHANGE: This is a breaking change"
> versionize --pre-release alpha
// Generates version v2.0.0-alpha.0

> versionize
// Generates version v2.0.0

Aggregated pre-releases changelog

By default, each commit message only appears in the release it was introduced. When using the pre-release feature this can result in a fragmented changelog. For example, when promoting to a full release the user has to browse through all the pre-release sections to see what's included.

v1.0.0-alpha.0
- featA
v1.0.0-alpha.1
- featB
v1.0.0

So to get around that you can pass the --aggregate-pre-releases flag

versionize --pre-release alpha
versionize --pre-release alpha
versionize --aggregate-pre-releases

to get output like the following

v1.0.0-alpha.0
- featA
v1.0.0-alpha.1
- featB
v1.0.0
- featA
- featB

This also works together with the pre-release option

versionize --pre-release alpha --aggregate-pre-releases

Skip pre-release tags

Some developers may prefer not to tag pre-releases. Here's an example of how to achieve that:

versionize --pre-release alpha --skip-tag
versionize --pre-release alpha --skip-tag --find-release-commit-via-message
...

find-release-commit-via-message is necessary because Versionize uses git tags by default to determine the current version. Without a git tag, the way we determine which commits get included in the changelog is by searching for the last commit message that starts with "chore(release):".

Configuration

You can configure versionize either by creating a .versionize JSON file the working directory.

Any of the command line parameters accepted by versionize can be provided via configuration file leaving out any -. For example skip-dirty can be provided as skipDirty in the configuration file. The .versionize configuration file is deserialized into a FileConfig.cs object behind the scenes.

You can also extend a shared configuration file using extends. The value can be a URL or a local file path. Local values override the extended config.

json
{
  "extends": "https://example.com/shared/.versionize",
  "skipDirty": true
}

Changelog customization can only be done via a .versionize file. The following is an example configuration:

…

Because includeAllCommits is true and the fix section is hidden, fix commits will appear in a section titled "Miscellaneous" (as specified by otherSection). If otherSection is not specified, it defaults to "Other".

Customizing Changelog Links

You can customize the links generated in the changelog using the linkTemplates configuration. The following placeholders are supported:

  • {issue} - Issue number (e.g., 123)
  • {commitSha} - Full commit SHA
  • {currentTag} - Current version tag (e.g., v1.2.3)
  • {previousTag} - Previous version tag (e.g., v1.2.2)

The {currentTag} and {previousTag} placeholders are particularly useful for creating compare links that show all changes between releases:

json
{
  "changelog": {
    "linkTemplates": {
      "versionTagLink": "https://github.com/versionize/versionize/compare/{previousTag}...{currentTag}"
    }
  }
}

This will generate links like: https://github.com/versionize/versionize/compare/v1.9.0...v1.10.0

Credits / Authors Section

You can add an opt-in Thank You section at the bottom of each changelog entry that lists the authors who contributed commits in that release. For public GitHub and GitLab repositories the author's username is resolved automatically; for other hosts, or private repositories, only the author name is shown.

Enable it in your .versionize file:

json
{
  "changelog": {
    "includeAuthors": true
  }
}

You can also customise the section heading:

json
{
  "changelog": {
    "includeAuthors": true,
    "authorsSection": "Contributors"
  }
}

This produces a section like:

markdown
### Thank You

* Alice Smith @alicesmith
* Bob Jones @bobjones
* Steven Nance

Authors are deduplicated by email and listed alphabetically. GitHub usernames are resolved via the GitHub commit API; GitLab usernames are resolved via the GitLab GraphQL API. Username resolution is only supported for public repositories — if username resolution fails or the repository is private or hosted elsewhere, only the author name is displayed.

Developing

Want to do a PR and not care about setting up your development environment? To get prettier test outputs run dotnet test with prettier test logger

bash
dotnet test --logger prettier

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#changelogdotnet-clidotnet-coregit

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具