Skip to content
.NET Core CLI tool to update the version information in .NET Core *.csproj files
Branch: master
Clone or download
Latest commit d512d62 Oct 29, 2018

dotnet-setversion is a simple .NET Core CLI tool used to update the version information within .NET Core *.csproj files.

It is based on dotnet-gitversion, but is updated to work for the new *.csproj format instead of project.json, and relies on the version information being passed to it.

NuGet Build status


Install dotnet-setversion as a global tool using the dotnet CLI:

$ dotnet tool install -g dotnet-setversion

If the command completed successfully, you're able to invoke dotnet-setversion in any directory like this:

$ setversion 0.1.2-beta0001

You can also update the version information of a specific project file by invoking like this:

$ setversion 0.1.2-beta0001 MyProject.csproj

If you happen to have a rather big repo including several project files and you want to update them all at once, you can use the --recursive option.
This will update any project file in and below the current working directory.

$ setversion -r 0.1.2-beta0001

For each example, replace '0.1.2-beta0001' with any valid version string or, when having GitVersion installed, with $(GitVersion -ShowVariable NuGetVersionV2) to use your current version automatically.

This (or something similar) can of course be done during a continuous integration build, which is the main intention behind developing this project.

Migrating from 1.* to 2.*

dotnet-setversion used to be a per-project tool, but has now been reworked as a .NET Core Global Tool.
As a consequence of this, you have to remove the <DotNetCliToolReference> element referencing dotnet-setversion or you'll get an error when running dotnet restore.

Depending on your build strategy, you have to install setversion once on your build agent (see Usage) or integrate the install command into your build script.

Finally you have to change the way to invoke the program from dotnet setversion to setversion.

You can’t perform that action at this time.