ReSharper 2019.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 run CleanupCode:

  1. Download ReSharper Command Line Tools

  2. Unzip the command line tools package in any directory.
    Ensure that the downloaded .zip file is 'unblocked' before extracting: right-click the file, select Properties and click Unblock. Failure to do this will cause the .NET framework to load the application in partial trust, which means it won't load or run correctly.

  3. Build the target solution.

  4. Run the following command:

    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 Built-in: Full Cleanup profile, that is all available cleanup tasks except updating file header.

There are two more built-in profiles — Built-in: Reformat Code, which will only applies code formatting preferences and Built-in: Reformat & Apply Code Style, which applies code formatting preferences and code syntax styles. To use another profile, pass the profile name via the --profile command-line argument of cleanupcode.exe, for example:

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,

  • --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, and so on. 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.

  • --debug (-d) — use this option to add execution details of CleanupCode to the output. If you have problems with CleanupCode, these details will be helpful when contacting the support team.

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: 18 November 2019