我将一个项目升级为。NET 5,安装了最新的Microsoft。代码分析。NetAnalyzer,我的电脑里有这个。编辑配置文件:
dotnet_diagnostic.CA1506.severity = error
为甚么我不能压抑呢?
在错误列表中,当我右键单击错误时,没有可抑制的选项。
因此,我手动将此属性添加到方法中:
[SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "Existing class that matches every other project. This error is more important for business logic and not setup.")]
public IServiceProvider ConfigureServices(IServiceCollection services)
但每次编译时都会出现错误。我错过了什么?
编辑2:我可以将鼠标悬停在不同的警告上并选择抑制它,但不能选择CA1506。