7

I have some files in my C# WPF project with Build Action set to Content. But these files don't contain C# code. Unfortunatelly, these files generates a lot of Warnings in Error List. How can I set these non-c# files to be ignored in "VS Warnig Analyzer"? I tried use Exclude from StyleCop, but warnings are still here...

EDIT: Example warnings (there is 1623 warnings for single .pak file)

Warning 498 Attribute ' C:\Users\Dominik\Projects\slidessync\SlidesSync\SlidesSync\cef.pak  41526   1   SlidesDrive.Windows
Warning 514 Attribute ' C:\Users\Dominik\Projects\slidessync\SlidesSync\SlidesSync\cef.pak  41472   17  SlidesDrive.Windows
Warning 538 Attribute ' C:\Users\Dominik\Projects\slidessync\SlidesSync\SlidesSync\cef.pak  41224   1   SlidesDrive.Windows
Warning 548 Attribute ' C:\Users\Dominik\Projects\slidessync\SlidesSync\SlidesSync\cef.pak  41194   1   SlidesDrive.Windows
Warning 549 Attribute ' C:\Users\Dominik\Projects\slidessync\SlidesSync\SlidesSync\cef.pak  41196   1   SlidesDrive.Windows
Warning 126 Attribute '�' already exists.   C:\Users\Dominik\Projects\slidessync\SlidesSync\SlidesSync\cef.pak  41208   1   SlidesDrive.Windows
Warning 132 Attribute '�' already exists.   C:\Users\Dominik\Projects\slidessync\SlidesSync\SlidesSync\cef.pak  41213   1071    SlidesDrive.Windows
Warning 210 Attribute '�' already exists.   C:\Users\Dominik\Projects\slidessync\SlidesSync\SlidesSync\cef.pak  41911   1   SlidesDrive.Windows
Warning 211 Attribute '�' already exists.   C:\Users\Dominik\Projects\slidessync\SlidesSync\SlidesSync\cef.pak  41912   87  SlidesDrive.Windows
Warning 222 Attribute '�' already exists.   C:\Users\Dominik\Projects\slidessync\SlidesSync\SlidesSync\cef.pak  41925   1   SlidesDrive.Windows
Dominik Palo
  • 2,873
  • 4
  • 29
  • 52

3 Answers3

11

Late, but the most obvious is to place in the top of the file

#pragma warning disable warning-list
panpawel
  • 1,782
  • 1
  • 16
  • 17
0

I had an html file giving 100 warnings that I couldn't change. I was copying it to the output folder and loading the file using code. I updated my project to mark the file as an embedded resource and that made the warnings go away.

TPINKS
  • 141
  • 2
-1

It seems to me these files are XML files, or another file type that Visual Studio recognizes. Visual Studio tries to check them if you open them (they don't have a compile time impact on warnings / errors). You can close them and the warnings will be gone.

You should probably:

  • Fix the issues if you can: double attributes are a bad idea. Use elements instead.
  • For XML: Add the XSD to Visual Studio to let Visual Studio correctly validate the XML file.
Community
  • 1
  • 1
Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325
  • no, no these files are not XML, these are files with combined mixed languges (HTML, CSS, binary data, some scripting language) for some 3rd library... but closing files resolved my problem – Dominik Palo Mar 26 '15 at 15:02
  • I'm here because is warnings in generated files. Changing the code is not an option. – Martin Mar 01 '23 at 12:49