{"id":24660226,"url":"https://github.com/skarpdev/dotnet-version-cli","last_synced_at":"2025-10-27T10:13:03.757Z","repository":{"id":37851383,"uuid":"88988263","full_name":"skarpdev/dotnet-version-cli","owner":"skarpdev","description":"dotnet version cli (similar to npm version cli)","archived":false,"fork":false,"pushed_at":"2024-12-20T11:21:43.000Z","size":291,"stargazers_count":41,"open_issues_count":24,"forks_count":13,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T09:08:11.547Z","etag":null,"topics":["cli","dotnet","dotnet-core","patch","tool","version","versioning"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skarpdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-21T13:46:03.000Z","updated_at":"2025-02-04T09:38:44.000Z","dependencies_parsed_at":"2024-06-19T23:25:22.700Z","dependency_job_id":"8e5457bb-2fd3-453f-a96f-262087c1f499","html_url":"https://github.com/skarpdev/dotnet-version-cli","commit_stats":null,"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skarpdev%2Fdotnet-version-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skarpdev%2Fdotnet-version-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skarpdev%2Fdotnet-version-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skarpdev%2Fdotnet-version-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skarpdev","download_url":"https://codeload.github.com/skarpdev/dotnet-version-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157283,"owners_count":20893220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","dotnet","dotnet-core","patch","tool","version","versioning"],"created_at":"2025-01-26T03:18:49.790Z","updated_at":"2025-10-27T10:13:03.667Z","avatar_url":"https://github.com/skarpdev.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build status](https://ci.appveyor.com/api/projects/status/r50rbldhoil6pqk6/branch/master?svg=true)](https://ci.appveyor.com/project/nover/dotnet-version-cli/branch/master)\n[![nuget version][nuget-image]][nuget-url]\n[![Sonar Quality][sonarqualitylogo]][sonarqubelink]\n[![Code coverage][sonarcoveragelogo]][sonarqubelink]\n[![Sonar vulnerabilities][sonarvulnerabilitieslogo]][sonarqubelink]\n[![Sonar bugs][sonarbugslogo]][sonarqubelink]\n[![Sonar code smells][sonarcodesmellslogo]][sonarqubelink]\n\n# dotnet-version-cli\n\nThis repository contains the source code for an [npm/yarn version][1] inspired dotnet global tool for dotnet with full [SemVer 2.0][semver2] compatibility!\n\nThis used to be a dotnet csproj installable `cli tool` - if you are not ready for the move to dotnet global tools, please take a look at the last [0.7.0 release that supports csproj installation](https://github.com/skarpdev/dotnet-version-cli/blob/v0.7.0/README.md).\n\nOnce installed it provides a `dotnet version` command which allows you to easily bump `patch`, `minor` and `major` versions on your project. You can also release and manage pre-release\nvesions of your packages by using the `prepatch`, `preminor` and `premajor` commands. Once in pre-release mode you can use the `prerelease` option to update the pre-release number.\n\nAlternatively it allows you to call it with the specific version it should set in the target `csproj`.\n\nWe do not aim to be 100% feature compatible with `npm version` but provide the bare minimum for working with version numbers on your libraries and applications.\n\nEffectively this means that issuing a `patch` command will\n\n- bump the patch version of your project with 1 - so 1.0.0 becomes 1.0.1\n- Create a commit with the message `v1.0.1`\n- Create a tag with the name `v1.0.1`\n\nSimilarly for `minor` and `major`, but changing different parts of the version number.\n\nWhen working with pre-releases using the `prepatch`, `preminor` and `premajor` options additional build meta can be passed using the `--build-meta` switch and the default `next` prefix can be changed using `--prefix`.\n\nTo control the output format the `--output-format` switch can be used - currently supported values are `json` and `text`. **Please beware** that output is only reformatted for success-cases, so if something is wrong you will get a non 0 exit code and text output!\nChanging output format works for both \"version bumping\" and the \"show version\" operations of the cli.\n\nThe commit and tag can be disabled via the `--skip-vcs` option.\n\nA completely dry run where nothing will be changed but the new version number is output can be enabled with the `--dry-run` switch. Performing a dry run also implies `skip vcs`.\n\nIf the current directory does not contain the `csproj` file to work on the `-f|--project-file` switch can be provided.\n\n## Installing the cli tool\n\nTo install the tool simply issue\n\n```bash\ndotnet tool install -g dotnet-version-cli\n```\n\nNow it should be available as\n\n```bash\ndotnet version\n```\n\nIt can also be executed directly as `dotnet-version` - both should produce output similar to\n\n```text\n$ dotnet version\ndotnet-version-cli\nProject version is:\n        1.3.0\n```\n\nUsing json output will produce\n\n```bash\n$ dotnet version --output-format=json\n{\"product\":{\"name\":\"dotnet-version-cli\",\"version\":\"0.7.0.0\"},\"currentVersion\":\"1.3.0\",\"projectFile\":\"C:\\\\your\\\\stuff\\\\project.csproj\"}\n```\n\nThe `product` bit is information about the cli tool itself.\n\n## Standard workflow\n\nYou have just merged a PR with a bugfix onto master and you are ready to release a new version of your library / application. The workflow is then\n\n```bash\n$ git pull\n$ dotnet version -f ./src/my.csproj patch\n$ git push \u0026\u0026 git push --tags\n```\n\n## Pre-release workflow\n\nAs mentioned in the introduction the version tool allows working with pre-releases.\nLet's assume you have a library in version `1.2.4` and have made merges to master. You are not sure these changes work in the wild and therefore you require a\npre-release. In the simpelest form you can\n\n```bash\n$ dotnet version preminor\n```\n\nTo get a preminor out. This new version tag would become `1.2.5-next.0`.\nIf additional changes are merged you can roll over the pre-release version number by\n```bash\n$ dotnet version prerelease\n```\nTo make the release `1.2.5-next.1`.\nWhen ready you can snap out of pre-release mode and deploy the final minor version\n```bash\n$ dotnet version minor\n```\nResulting in the version `1.2.5`.\n\nAll other command line flags like `-f` apply, and you can also include `build meta` as per SemVer 2.0 spec, like so:\n```bash\ndotnet version --build-meta `git rev-parse --short HEAD` preminor # or prerelease etc.\n```\nTo have a resulting version string like `1.2.5-next.1+abcedf`\n\nIf the default `next` prefix is not desired it can easily be changed using the `--prefix` switch like so:\n```bash\ndotnet version --prefix beta preminor # or prerelease etc.\n```\n\nResulting in `1.2.4-beta.0`.\n\n## Possible CI workflow\n\nIf you do not care that commits and tags are made with the current version of your library, but simply wish to bump the version of your software when building on master, the tool can be used as (powershell example):\n\n```powershell\ndotnet version \"1.0.$env:BUILD_ID\"\n```\n\nreplacing `BUILD_ID` with whatever variable your build environment injects.\nThe total count of commits in your git repo can also be used as a build number:\n\n```powershell\n$revCount = \u0026 git rev-list HEAD --count | Out-String\ndotnet version \"1.0.$revCount\"\n```\n\n## Change commit message\n\nIf you want to change defaults commit message, you can use the flag `-m` or `--message`.\n```bash\n$ dotnet version minor -m \"Commit message\"\n```\n\nThere are variables availables to be set in the message\n\n`$projName` will be replaced for package title (or package id if its not defined)\n\n`$oldVer` will be replaced for old version of the package\n\n`$newVer` will be replaced for new version of the package\n```bash\n$ dotnet version minor -m \"$projName bumped from v$oldVer to v$newVer\"\n# This will be replaced as\n# ProjectName bumped from v1.0.0 to v2.0.0\n```\n\n\n## Change tag message\n\nIf you want to change defaults tag message, you can use the flag `-t` or `--tag`.\n```bash\n$ dotnet version minor -t \"Tag\"\n```\n\nThere are variables availables to be set in the tag\n\n`$projName` will be replaced for package title (or package id if its not defined)\n\n`$oldVer` will be replaced for old version of the package\n\n`$newVer` will be replaced for new version of the package\n```bash\n$ dotnet version minor -t \"$projName bumped from v$oldVer to v$newVer\"\n# This will be replaced as\n# ProjectName bumped from v1.0.0 to v2.0.0\n```\n\n## Common Version\nIf you want to share a version across multiple csproj files, you can create a `.targets` file and [import](import) it in the csproj files:\n`Common.targets`:\n```xml\n\u003cProject\u003e\n  \u003cPropertyGroup\u003e\n    \u003cVersion\u003e2.0.0\u003c/Version\u003e\n  \u003c/PropertyGroup\u003e\n\u003c/Project\u003e\n```\n\nAnd in your `.csproj` files:\n```xml\n\u003cProject Sdk=\"Microsoft.NET.Sdk\"\u003e\n  \u003cImport Project=\"relative/path/to/Common.targets\" /\u003e\n\u003c/Project\u003e\n```\n\nYou can then use `dotnet version` to change the version in `Common.targets`:\n```powershell\ndotnet version -f Common.targets\n```\n\n[1]: https://docs.npmjs.com/cli/version\n[nuget-image]: https://img.shields.io/nuget/v/dotnet-version-cli.svg\n[nuget-url]: https://www.nuget.org/packages/dotnet-version-cli\n[semver2]: https://semver.org/spec/v2.0.0.html\n[sonarqubelink]: https://sonarcloud.io/dashboard?id=skarpdev_dotnet-version-cli\n[sonarqualitylogo]: https://sonarcloud.io/api/project_badges/measure?project=skarpdev_dotnet-version-cli\u0026metric=alert_status\n[sonarcoveragelogo]: https://sonarcloud.io/api/project_badges/measure?project=skarpdev_dotnet-version-cli\u0026metric=coverage\n[sonarvulnerabilitieslogo]: https://sonarcloud.io/api/project_badges/measure?project=skarpdev_dotnet-version-cli\u0026metric=vulnerabilities\n[sonarbugslogo]: https://sonarcloud.io/api/project_badges/measure?project=skarpdev_dotnet-version-cli\u0026metric=bugs\n[sonarcodesmellslogo]: https://sonarcloud.io/api/project_badges/measure?project=skarpdev_dotnet-version-cli\u0026metric=code_smells\n[import]: https://docs.microsoft.com/en-us/visualstudio/msbuild/import-element-msbuild?view=vs-2019\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskarpdev%2Fdotnet-version-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskarpdev%2Fdotnet-version-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskarpdev%2Fdotnet-version-cli/lists"}