ReSharper 2018.2 Help

CleanupCode Command-Line Tool

CleanupCode is a free command-line tool that can perform code cleanup to instantly eliminate code style violations in a project or solution and ensure a uniform code base. To use CleanupCode, you need to download ReSharper Command Line Tools, unzip the command line tools package, and then run:

cleanupcode.exe YourSolution.sln

Configuring CleanupCode with command-line arguments

By default, CleanupCode will scan all files in the solution and apply code cleanup tasks specified in the Full Cleanup profile.

There is one more built-in profile — Reformat Code, which will apply only code formatting preferences. To use it, pass the profile name via the --profile command-line argument of cleanupcode.exe:

cleanupcode.exe --profile="Built-in: Reformat Code" YourSolution.sln

Besides --profile, you can use the following command-line arguments:

  • --settings — by default, CleanupCode will override its default settings with ReSharper settings from the 'Solution team-shared' layer (SolutionName.DotSettings), if it exists. If necessary, you can use this parameter to specify another .DotSettings file, which will override all other settings. For example,
    --settings="C:\Work\MyRsSettings.DotSettings".
  • --include/--exclude — relative path(s) that define the files to include/exclude during the cleanup.
  • --disable-settings-layers (-dsl) — disables specified settings layers. Accepted values: GlobalAll, GlobalPerProduct, SolutionShared, SolutionPersonal
  • Several options related to MSBuild, cache folders, etc. Details are available from cleanupcode.exe --help.
  • --config-create and --config — these options allow you to pass the parameters described above with a configuration file. The first option will create a configuration file according to the current parameters; the second option is used to load the parameters from this file.

Configuring CleanupCode with ReSharper settings

If you have previously worked on the target solution with ReSharper, you may have already configured code style settings. If so, CleanupCode will find your custom settings in .DotSettings files and apply them.

CleanupCode will read the following preferences from ReSharper-settings files:

If you want to configure CleanupCode on a CI server, you can make all configurations locally with ReSharper, save the settings to the Solution Team-Shared layer, and then commit the resulting YourSolution.sln.DotSettings file in the solution directory to your VCS. CleanupCode on the server will find and apply these settings.

As an alternative, you can specify a path to a shared .DotSettings file (which will override settings in other settings files, if any) through the --settings parameter.

Supported languages

CleanupCode supports the following languages:

Language: C# Language: VB.NET Language: C++ Language: HTML Language: ASP.NET Language: Razor Language: JavaScript Language: TypeScript Language: CSS Language: XML Language: XAML Language: Resx Language: Build Scripts Language: Protobuf Language: JSON
Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available
Last modified: 12 September 2018