MartinCostello.DotNetBumper 0.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global MartinCostello.DotNetBumper --version 0.2.1
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local MartinCostello.DotNetBumper --version 0.2.1
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=MartinCostello.DotNetBumper&version=0.2.1
nuke :add-package MartinCostello.DotNetBumper --version 0.2.1

.NET Bumper โ›๐Ÿ“ฆโคด๏ธโœจ

[!NOTE] This project is currently experimental.

NuGet

Build status codecov OpenSSF Scorecard

Overview

.NET Bumper is a .NET Global Tool to upgrade projects to a newer version of .NET.

.NET Bumper in action

Bumper helps you upgrade your .NET projects to a newer version by taking care of some of the steps required to move from one version to another. Bumper supports upgrading to both Long Term Support (LTS) and Standard Term Support (STS) versions of .NET, and the latest preview versions of .NET. ๐Ÿš€

Steps the tool can perform on your behalf include:

  • Updating the .NET SDK version in global.json ๐Ÿง‘โ€๐Ÿ’ป
  • Upgrading the Target Framework of your project files โš™๏ธ
  • Upgrading .NET, ASP.NET Core and EFCore NuGet packages to the appropriate versions ๐Ÿ“ฆ
  • Updating image tags in Dockerfiles ๐Ÿณ
  • Running dotnet test to validate the upgrade ๐Ÿงช

[!NOTE] Upgrades are made on a best-effort basis. You should always review the changes made by the tool and test any changes made to validate the upgrade.

Quick Start

To install the tool and upgrade a .NET 6 or later project to the latest Long Term Support (LTS) version of .NET, run the following command:

dotnet tool install --global MartinCostello.DotNetBumper
dotnet bumper .

Usage

For a full list of options, run dotnet bumper --help.

An example of the output is shown below.

Examples

Upgrade a project to the current LTS version of .NET

dotnet bumper ~/projects/awesome-project

Upgrade a project to the latest version of .NET

dotnet bumper ~/projects/awesome-project --upgrade-type Latest

Upgrade a project to the preview version of .NET

dotnet bumper ~/projects/awesome-project --upgrade-type Preview

Upgrade a project to a specific version of .NET

dotnet bumper ~/projects/awesome-project --channel 8.0

Upgrade a project to the current LTS version of .NET and then run dotnet test after the upgrade has completed

dotnet bumper ~/projects/awesome-project --test

Options

> dotnet bumper --help
Upgrades projects to a newer version of .NET.

Usage: dotnet bumper [options] <ProjectPath>

Arguments:
  ProjectPath                      The path to directory containing a .NET 6+ project to be upgraded. If not specified,
                                   the current directory will be used.

Options:
  -v|--verbose                     Show verbose output
  --version                        Show version information.
  -?|-h|--help                     Show help information.
  -cf|--configuration-file <PATH>  The path to a custom JSON or YAML configuration file to use, if any.
  -c|--channel <CHANNEL>           The .NET release channel to upgrade to in the format "major.minor".
  -lf|--log-format <FORMAT>        The log format to use.
                                   Allowed values are: None, Json, Markdown, GitHubActions.
                                   Default value is: None.
  -lp|--log-path <PATH>            The path to write the log file to, if any.
  -q|--no-logo                     Do not display the startup banner.
  -t|--upgrade-type <TYPE>         The type of upgrade to perform.
                                   Allowed values are: Lts, Latest, Preview.
  -test|--test                     Test the upgrade by running dotnet test on completion.
  -e|--warnings-as-errors          Treat any warnings encountered during the upgrade as errors.
Custom Configuration File

A custom configuration file can be used to specify some additional options to change the behaviour of Bumper for a specific repository. The possible options are documented in the schema file. The format of the file can be either JSON or YAML.

Bumper automatically loads the configuration file from directory containing the project to upgrade if one of the following files is found:

  • .dotnet-bumper.json
  • .dotnet-bumper.yml
  • .dotnet-bumper.yaml

The file can also be explicitly specified using the --configuration-file option.

An example JSON and YAML configuration file are shown below:

{
  "$schema": "https://raw.githubusercontent.com/martincostello/dotnet-bumper/main/dotnet-bumper-schema.json",
  "excludeNuGetPackages": [
    "System.Text.Json"
  ],
  "includeNuGetPackages": [
    "Npgsql"
  ],
  "noWarn": [
    "NU1605"
  ],
  "remainingReferencesIgnore": [
    "tools/*"
  ]
}
excludeNuGetPackages:
  - System.Text.Json
includeNuGetPackages:
  - Npgsql
noWarn:
  - NU1605
remainingReferencesIgnore:
  - "tools/*"

Pre-requisites

  • .NET 8 must be installed to use the tool
    • The .NET SDK version to upgrade to must also be installed if this is different
  • The dotnet-outdated .NET Global tool must also be installed
  • Any project being upgraded must already target at least .NET 6

Building and Testing

Compiling the application yourself requires Git and the .NET SDK to be installed.

To build and test the application locally from a terminal, run the following set of commands:

git clone https://github.com/martincostello/dotnet-bumper.git
cd dotnet-bumper
dotnet tool restore
./build.ps1

Feedback

Any feedback or issues can be added to the issues for this project in GitHub.

Repository

The repository is hosted in GitHub: https://github.com/martincostello/dotnet-bumper.git

License

This project is licensed under the Apache 2.0 license.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
0.6.2 57 5/9/2024
0.6.1 136 5/7/2024
0.6.0 394 4/22/2024
0.5.3 432 4/15/2024
0.5.2 173 4/5/2024
0.5.1 104 4/4/2024
0.5.0 150 4/2/2024
0.4.1 3,632 3/27/2024
0.4.0 182 3/22/2024
0.3.3 169 3/11/2024
0.3.2 127 3/8/2024
0.3.1 88 3/7/2024
0.3.0 129 3/5/2024
0.2.1 223 2/29/2024
0.2.0 163 2/27/2024
0.1.1 151 2/22/2024
0.1.0 1,200 2/20/2024