简体   繁体   中英

Can I run EditorConfig over C# Files From the Command Line?

Newer versions of Visual Studio Support EditorConfig within the IDE which is useful, however it would be best if I could run it from the command line (and therefore in automation).

Is there any stand alone tool that supports all of the EditorConfig Settings as the Visual Studio IDE does? Microsoft Docs: .NET coding convention settings for EditorConfig

Here's what I have found so far:

Baring a stand alone tool is there any way to force Visual Studio into running the code cleanup "headless"? That might be my only solution.

I've been hunting for the same thing, just found a very new tool for this, dotnet-format , put out from the Roslyn team:

https://github.com/dotnet/roslyn/tree/master/src/Tools/dotnet-format

From their README:

dotnet-format is a code formatter for dotnet 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.

Looks like the indented usage is something like:

$ dotnet format -w MyApplication.sln

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