StyleCop 警告未被抑制

StyleCop warning not suppressed

我想抑制某个方法的 stylecop 警告。所以我添加了以下 SuppressMessage:

[SuppressMessage("Microsoft.StyleCop.CSharp.Naming", "SA1306:FieldNamesMustBeginWithLowerCaseLetter", Justification = "MDS tables names need to be in capital letters")]
internal static class OffersDataProcessor
{
    public static async Task<List<Offer>> RetrieveAndProcessOffersAsync(string BaseUrl, string baseUrlKey)
    {
       ...
    }
    ...
}

但这仍然在控制台构建中发出警告: D:\ProjectSolutionDir\ProjectSolution\Helpers\OffersDataProcessor.cs(26, 1): warning : SA1306 : CSharp.Naming : 变量名称和私有字段名称必须以小写字母开头:BaseUrl。 [D:\ProjectSolutionDir\ProjectSolution.csproj]

第 26 行 1 是 BaseUrl 所在的位置。我应该添加其他东西来抑制警告吗?

问题是命名空间不正确。我不得不使用 Microsoft.StyleCop.CSharp.NamingRules 而不是 Microsoft.StyleCop.CSharp.Naming。这解决了问题。