我可以从命令行在C#文件上运行EditorConfig吗?

问题描述 投票:1回答:1

IDE中较新版本的Visual Studio支持EditorConfig非常有用,但最好是从命令行运行它(因此在自动化中)。

是否有任何支持Visual Studio IDE支持所有EditorConfig设置的独立工具? Microsoft Docs: .NET coding convention settings for EditorConfig

这是我到目前为止所发现的:

单独使用独立工具是否有任何方法可以强制Visual Studio运行代码清理“无头”?这可能是我唯一的解决方案。

c# code-cleanup editorconfig
1个回答
2
投票

我一直在寻找同样的东西,只是找到了一个非常新的工具,dotnet-format,从罗斯林团队推出:

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

从他们的自述文件:

dotnet-formatdotnet的代码格式化程序,它将样式首选项应用于项目或解决方案。首选项将从.editorconfig文件中读取(如果存在),否则将使用默认的首选项集。

看起来像缩进的用法是这样的:

$ dotnet format -w MyApplication.sln
© www.soinside.com 2019 - 2024. All rights reserved.