TaskIt.Dotnet.Versions
Simple dotnet tool for setting / modifying version tags in .csproj files. This tool overwrites / modifies the following tags in your .csproj files (if present):
Version
AssemblyVersion
FileVersion
This tool supports semantic versioning for the Version Tag.
VersionPrefix
and VersionSuffix
tags will not be processed.
Only files containing at least one of the tags will be modified.
Installation
Like all dotnet tools this tool can be used on a project / solution level (simply add the nuget dependency) or be installed as a global tool.
Simply use the following commmand:
dotnet tool install --global TaskIt.Dotnet.Versions
Usage
Simply call:
dotnet versions <operation> <parameters>
Supported operations
Set
set
will overwrite the version tags in the .csproj file(s).
Parameter | Required | Description |
---|---|---|
-v --version
|
yes | string - The new Version to set. The version string must be semver 2.0 compliant. In extension of the specification you can use wildcards ( * ) to spare some digits in the version string. Wildcards apply only to the major , minor and patch versions and will not be overwritten.For AssemblyVersion and FileVersion tags, only the major , minor and patch versions will be overwritten |
See the examples section for more information.
Modify
mod
will increment / modify the versions tags in the .csproj files.
Parameter | Required | Description |
---|---|---|
-v --version
|
yes | string - The pattern in whith the Version (major .minor .patch ) will be modifiedYou can use wildcards ( * ) to spare some digits in the version string.Any digit specified will be added to the correspondending major , minor or patch version.A value of 0 will be set as the correspondending major , minor or patch version.The same applies to AssemblyVersion and FileVersion tags. |
-p --semverpattern
|
no | string - regular expression for finding the semantic part of the version which should be modified (don't forget the capture group) |
-m --semvermodifier
|
no | int - summand which will be added to the captured number |
See the examples section for more information.
Common Paramters
Parameter | Required | Description |
---|---|---|
-f --folder
|
no | path (relative or absolute) to your solution / project folder. This tool works allways recurvise. If omitted, the current directory will be used. |
-b --backup
|
no | true / false (default = false) If set, a backup of the processed .csproj files will be created. Filename: yourproject.csproj.backup |
Examples
Set
call | original version | modified version |
---|---|---|
dotnet versions set -v 1.1.0 |
<Version>1.1.0-RC5+Build33</Version> <AssemblyVersion>1.1.0.0</AssemblyVersion> <FileVersion>1.1.0.0</FileVersion>
|
<Version>1.1.0</Version> <AssemblyVersion>1.1.0.0</AssemblyVersion> <FileVersion>1.1.0.0</FileVersion>
|
dotnet versions set -v 1.1.1-RC1+Build1 |
<Version>1.1.0</Version> <AssemblyVersion>1.1.0.0</AssemblyVersion> <FileVersion>1.1.0.0</FileVersion>
|
<Version>1.1.1-RC1+Build1</Version> <AssemblyVersion>1.1.1.0</AssemblyVersion> <FileVersion>1.1.1.0</FileVersion>
|
dotnet versions set -v *.2.0 |
<Version>3.1.1-RC5</Version> <AssemblyVersion>2.1.1.0</AssemblyVersion>
|
<Version>3.2.0</Version> <AssemblyVersion>2.2.0.0</AssemblyVersion>
|
Mod
call | original version | modified version |
---|---|---|
dotnet versions mod -v 1.1.0 |
<Version>1.0.1-RC5+Build33</Version> |
<Version>2.1.0-RC5+Build33</Version> |
dotnet versions mod -v *.2.0 -p beta(\d+) -m 1 |
<Version>5.1.1-RC12-beta1+build47</Version> |
<Version>5.3.0-RC12-beta2+build47</Version> |
dotnet versions mod -v *.2.0 |
<Version>2.1.1-RC5</Version> <AssemblyVersion>2.1.1.0</AssemblyVersion>
|
<Version>2.2.0</Version> <AssemblyVersion>2.2.0.0</AssemblyVersion>
|