Avinash patil
Avinash patil

Reputation: 1819

Suppress Error in Suppression file gives error : The Selected Message Could not be suppressed

enter image description here

I am Using Visual Studio 2015, FxCop 14.0. with Custom rules, and trying to suppress message in GlobalSuppressions.cs. I have set path of the Global Suppression in Project file <PropertyGroup ..> .. .. <CodeAnalysisModuleSuppressionsFile>$(SolutionDir)\xxx\xx\xxx\GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> </PropertyGroup>

can anyone please help me fix this.

Upvotes: 4

Views: 2271

Answers (3)

CSCoder
CSCoder

Reputation: 150

For those who stumble upon this...

The above answers did not work for me. So give them a try first but if that doesn't work here's what did it for me:

  1. Delete all GlobalSuppressions.cs files from the project
  2. Clean the solution.
  3. Select Analyze > Configure Code Analysis > For Solution
  4. Find the project with troubles and select Reset
  5. Run Code Analysis and everything should be good

Upvotes: 0

Wim Coenen
Wim Coenen

Reputation: 66753

This means that there is already a GlobalSuppressions.cs file present, but it is not included in the project.

To resolve this, enable "Show All Files" in the solution explorer, right-click the GlobalSuppressions.cs file which should now appear, and "Include In Project".

Upvotes: 4

Avinash patil
Avinash patil

Reputation: 1819

I have done following steps and problem get resolved :

  1. Delete the existing GlobalSuppression.cs file from project.
  2. Clean Solution and rebuild.
  3. Now try to suppress the errors. This will create new file and will suppress all warnings.

Upvotes: 2

Related Questions