VS2022代码分析配置选项非常混淆
当我在VS2022中构建C#解决方案时,我会看到各种代码分析构建警告,例如:
IDE0090'new'表达式可以简化
我想将其中一些的严重性更改为“建议”,我认为这将继续显示编辑器Squiggle/Light Bulb,而不是构建警告。当我单击代码线旁边的灯泡时,出现了这组菜单:
有人可以解释四个'配置...'菜单选项之间的区别吗?即
- “配置IDE 0090代码样式”
- “配置IDE0090严重性”
- “为所有'样式'分析仪配置配置严重性”
- “为所有分析仪配置严重性
(第一个选项提供了“ true”&“ false”选择,而其他三个选项则提供“无”,而另外三个则提供“无”。 “,”静音”,...)
我不知道这是否相关,但是我的解决方案中的每个项目中都安装了“ stylecop.analyzer”软件包。
顺便说一句,在旁边看到的“更改预览窗格”图像的RH侧显示,它希望将新行添加到我的.editorConfig文件中,该文件属于解决方案的根文件夹中(我已经确认是根据行号和预览中看到的最后现有行)确认的是此文件)但是,每当我进行选择时,我会看到IDE 0090作为构建警告)
。到.editorconfig我自己通过记事本,然后警告消失了。
When I build my C# solution in VS2022 I see various code analysis build warnings, for example:
IDE0090 'new' expression can be simplified
I'd like to change the severity of some of these to "suggestion", which I assume will continue to display the editor squiggle/light bulb but not the build warning. When I click the light bulb next to the line of code, this set of menus appears:
Could someone explain the difference between the four 'Configure...' menu options please? I.E.
- "Configure IDE0090 code style"
- "Configure IDE0090 severity"
- "Configure severity for all 'Style' analyzers"
- "Configure severity for all analyzers
(The first option provides "true" & "false" choices, while the other three provide "None", "Silent", ...)
I don't know if this is relevant but I have the "StyleCop.Analyzers" package installed in each project in my solution.
As an aside, the "change preview pane" seen on the r.h. side of the image shows it wanting to add the new lines to my .editorconfig file, which lives in the solution's root folder (I've confirmed it is this file, based on the line numbers and last existing lines seen in the preview). However whenever I make a selection it never updates the file (and I continue to see IDE0090 appear as a build warning). Am I missing something? The file isn't read-only!
If I add the lines seen in the preview window to .editorconfig myself via Notepad then the warnings disappear.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论