A great tool for formatting CSharp code in .NET Core projects is the free ReSharper command line tool. You can install the tools in your project to allow easy reformatting of C# apps.
Install Resharper linting tools
The first step is to create a tool manifest:
dotnet new tool-manifest
Add the Resharping cli
Install the JetBrains prettier alternative using the command:
dotnet tool install JetBrains.ReSharper.GlobalTools
Then restore your project with
dotnet tool restore.
Format your code
Now to clean up your code run the tool via this command:
dotnet tool run jb cleanupcode [your-solution]