英文:
How to use `dotnet format` to apply specific StyleCop rule globally?
问题
我已经在我的使用C#编写的项目上安装了StyleCop.Analyzers
。规则的严重性设置为suggestion
。
我应该如何使用dotnet format
在整个项目上应用特定的规则?
我尝试执行dotnet format SolutionName.sln --diagnostics SA1122
,以将所有的""
替换为string.Empty
。许多文件已经更新(文件时间戳已更改),但没有一个""
被替换为预期的string.Empty
。
我应该如何使用dotnet format
全局应用特定的格式规则,以便不必手动进行更改?
英文:
I have installed StyleCop.Analyzers
on my project that is written using C#
. The rules severity are set to suggestion
.
How can I apply specific rules on the entire project using dotnet format
?
I tried executing dotnet format SolutionName.sln --diagnostics SA1122
to convert all ""
to string.Empty
. Many files were updated (file timestamp changed), but none of the ""
were replaced by string.Empty
as expected.
How can I use dotnet format
to apply specific format rule globally so I don't have to manually make the changes?
答案1
得分: 0
这可能是CLI命令中的问题。当与其他参数一起使用时,如 --severity info
时,它可以正常工作。
dotnet format SolutionName.sln --severity info --diagnostics SA1122
英文:
This maybe an issue in the CLI command. It works when used with other arguments like --severity info
dotnet format SolutionName.sln --severity info --diagnostics SA1122
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论