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:
Download ReSharper Command Line Tools
Unzip the command line tools package in any directory.
Ensure that the downloaded .zip file is 'unblocked' before extracting: right-click on 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.
Build the target solution.
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 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:
--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.
-dsl) — disables specified settings layers. Accepted values:
Several options related to MSBuild, cache folders, etc. Details are available from
--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:
Code formatting rules ( and )
Syntax styles ( )
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