FxCop does not respect my exceptions

I am trying to include FxCop directly in my assembly. I use MSBuild community tasks. I have a goals file, for example:

<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <FxCopToolPath Condition="'$(FxCopToolPath)' == ''">$(MetaSharpLibPath)\FxCop</FxCopToolPath> <FxCopCustomDictionary Condition="'$(FxCopCustomDictionary)' == ''">$(FxCopTooLPath)\CustomDictionary.xml</FxCopCustomDictionary> <MSBuildCommunityTasksLib>..\MSBuild.Community.Tasks\MSBuild.Community.Tasks.dll</MSBuildCommunityTasksLib> </PropertyGroup> <UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.FxCop" /> <Target Name="AfterBuild" > <ItemGroup> <FxCopRuleAssemblies Include="DesignRules.dll" /> <FxCopRuleAssemblies Include="GlobalizationRules.dll" /> <FxCopRuleAssemblies Include="InteroperabilityRules.dll" /> <FxCopRuleAssemblies Include="MobilityRules.dll" /> <FxCopRuleAssemblies Include="NamingRules.dll" /> <FxCopRuleAssemblies Include="PerformanceRules.dll" /> <FxCopRuleAssemblies Include="PortabilityRules.dll" /> <FxCopRuleAssemblies Include="SecurityRules.dll" /> <FxCopRuleAssemblies Include="SecurityTransparencyRules.dll" /> <FxCopRuleAssemblies Include="UsageRules.dll" /> <FxCopTargetAssembly Include="@(MainAssembly)" /> </ItemGroup> <FxCop ToolPath="$(FxCopToolPath)" CustomDictionary="$(FxCopCustomDictionary)" RuleLibraries="@(FxCopRuleAssemblies)" TargetAssemblies="@(FxCopTargetAssembly)" DependencyDirectories="@(ReferencePath)" FailOnError="True" ConsoleXslFileName="$(FxCopToolPath)\Xml\VSConsoleOutput.xsl" DirectOutputToConsole="true" /> </Target> </Project> 

It works fine except that by adding [SuppressMessage] warnings, they still appear in my release. I created a .fxcop project file and turned on the output assembly and tried to run it that way, but the same thing happens. Does FxCop not seem to respect my suppressions, any ideas?

Here's an example of suppression that doesn't work (GlobalSuppressions.cs):

 [module: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "MetaSharp.Transformation.Lang")] 

which was generated by the fxcop tool. Any ideas?

+4
source share
1 answer

Have you added the symbol CODE_ANALYSIS to the conditional symbols for compiling your project?

+8
source

All Articles