I am trying to use Visual Studio 2022 for a C#
project I am working on. I have created a .editorconfig
file at the root of my solution where I defined all the rules I want to follow in my solution. Now, I am hoping for a way I can apply all these rules on the entire solution.
Using Code Cleanup profile, I can include fixers/rules which will be executed on the entire project. But, in my case, all the rules are in the .editorconfig
. I don't know if there is a way to convert the rules in .editorconfig
to fixers.
How can I force VS2022 to apply all the rules .editorconfig
on my entire solution?
CodePudding user response:
The solution is dotnet format ./SolutionName.sln --no-restore
.
Here is the official documentation about the dotnet format.
Dotnet format is a code formatter that applies style preferences to a project or solution. Preferences will be read from an .editorconfig file, if present, otherwise a default set of preferences will be used. For more information, see the EditorConfig documentation.