简体   繁体   中英

Is there a way to apply the rules in .editorconfig in Visual Studio 2022 on the entrie solution?

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM