Swallow.Refactor 2.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global Swallow.Refactor --version 2.1.0
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 Swallow.Refactor --version 2.1.0
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Swallow.Refactor&version=2.1.0
nuke :add-package Swallow.Refactor --version 2.1.0


Refactor goes BRRR!

A tool to automatically refactor large swaths of code - the natural continuation of "doing it all by hand" and "tinkering with regexes". You can define a rewriting process and have it executed on many files in a solution - repeatable, testable, predictable.

What's BRRR short for, you ask? Boundless Roslyn Refactoring Runner.


brrr refactor -s|--solution <solution> [--filter-name <name>] [--filter-content <content>] <rewriters>

When calling refactor, instead of passing all rewriters via CLI you can instead pass the path to a JSON file. This file must match the following scheme:

  "filter": {
    "name": "<some regex>", // A regex that filenames should match, optional
    "content": "<some text>" // A text that files should contain, optional
  "rewriters": [
    { "name": "<some rewriter>" }, // A rewriter without any parameters
    { "name": "<some rewriter>", "parameters": [ "parameter", "parameter" ] } // A rewriter with parameters

To find out what rewriters are available, you can use brrr rewriter list and brrr rewriter describe <rewriter>.

BRRRadditional commands

brrr unused -s|--solution <solution> -o|--output <file> <project>

Find unused symbols (i.e. properties and methods, not fields as of now) in the given <project> and log them to file.

brrr references -s|--solution <solution> <project>

List all direct and transitive project references of then given <project>.


Building and installing yourself

To install the tool (and thus make it available globally), you can use the following command:

dotnet pack -c Release -o packages/
dotnet tool install --global --no-cache --add-source packages/ Swallow.Refactor

This will make brrr be a globally executable tool. To uninstall it again, you can execute:

dotnet tool uninstall --global Swallow.Refactor
Note for users of just

If you've got just installed, you can use just install, just uninstall or just reinstall! Take a look at the justfile, there're some neat things for you.

Installing via NuGet

The tool is published on NuGet as well. To install it from there, you can use the following command:

dotnet tool install --global Swallow.Refactor


If you want to use your own rewriters, commands, symbol filters, you name it - you can pass your own assemblies to the execution. They will get picked up and the relevant classes are available in all the use-cases as if they were embedded in the program!

Invoking the tool using the -p or --plugin option passing a list of semicolon-separated filepaths will load each assembly.

brrr -p|--plugin SomeAssembly.dll;SomeOtherAssembly.dll list

Using this, you will have access to all IRewriters of all passed-in assemblies in addition to the included ones.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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
3.1.0 0 4/24/2024
3.0.0 97 1/20/2024
2.1.0 231 10/21/2023
2.0.1 157 7/30/2023
2.0.0 133 6/15/2023
1.0.1 140 6/4/2023
1.0.0 178 4/10/2023

See RELEASE_NOTES.md for release notes