Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress Compiler Warnings in VS2010

I'm trying to clear the warnings given when my solution compiles in VS2010. Currently there are some 600, but most seem to be due to MSpec files.

How can I suppress the warnings for any file that ends *spec.cs? They're for MSpec tests and fixing many of them break the flow of the test code. I'm sure I won't need to consider those when the product is shipped.

like image 218
big_tommy_7bb Avatar asked Dec 06 '22 00:12

big_tommy_7bb


2 Answers

In C# go to Project > Properties Alt+F7 > Build page > Errors and warnings section > Suppress warnings text box. Enter numbers of the warnings separated by comma or semicolon.

In C++ go to Project > Properties > Configuration Properties > C/C++ > Advanced > Disable Specific Warnings text box. Enter numbers of the warnings separated by semicolon.

like image 58
Dialecticus Avatar answered Feb 04 '23 09:02

Dialecticus


At the top of the file put:

#pragma warning disable

Or for a specific warning: (for example warning CS0649)

#pragma warning disable 649
like image 25
srk Avatar answered Feb 04 '23 10:02

srk