Note: implicit in this doc is that we keep the name format as the root command.
Command Format: dotnet format <workspace> --fix-whitespace
Fixes whitespace only. Just looks at files and folders
Alias: 'w'. Invoking dotnet format without any arguments is equivalent to doing dotnet format --fix-whitespace
Arguments:
workspace(Optional): a folder or file (must exist). If the path evaluated to either aslnfile or acsprojfile we will attempt to laod it to determine the set of files to format. If the path evaluated to a folder or is not specified dotnet format uses the directory it was invoked from and just recurses through the files in that directory.
Command Format: dotnet format <workspace> --fix-style <severity>
Only fixes code style (aka code cleanup). Loads your solution or project.
Alias: 's'
Arguments:
-
workspace(Optional): a path that contains a solution or project. soC:\workspaceis a valid workspace if it has eitherC:\workspace\*.slnorC:\workspace\*.csproj. This mirrors the behavior fordotnet buildi.e. ifdotnet buildworks for a path thendotnet format --fix-styleshould also work. If not specified dotnet format uses the directory it was invoked from. -
severity(Optional): the severity of the code style options to fix. By default it isinfoto ensure it fixes everything that is specified in your editorconfig file. Possible values areinfo,warning, anderror.
Command Format: dotnet format <workspace> --fix-analyzers <severity>
Alias: 'a'
Arguments:
workspace(Optional): evaluated identically to how it is for--fix-style. If not specified dotnet format uses the directory it was invoked from.
Command Format: dotnet format <workspace> --fix-all <severity>
Alias: no alias for this command. passing -wsa will do the same thing.
Arguments:
-
workspace(Optional): evaluated identically to how it is for--fix-style -
severity(Optional): the severities passed into both the--fix-styleand--fix-analyzerscommands.
I will also note that I think
--excludeis another solution here. It seems like we have several mechanisms to include/exclude files as the user wants. I am still on the fence as the whether we really want a--folderoption.