Supress Compiler Warnings in VS2010

I am trying to clear warnings when my solution compiles in VS2010. There are currently around 600, but most of them seem to be related to MSpec files.

How can I suppress warnings for any file ending with * spec.cs? They are designed for MSpec tests and record that many of them disrupt the flow of test code. I am sure that I will not need to take them into account when sending the product.

+4
source share
2 answers

In C #, go to Project> Properties Alt + F7> Build Page> Errors and Warnings section> Suppress Warnings. Enter the number of alerts separated by a comma or semicolon.

In C ++, go to Project> Properties> Configuration Properties> C / C ++> Advanced> Disable Specific Warnings. Enter the number of warnings separated by semicolons.

+9
source

At the top of the file, put:

#pragma warning disable 

Or for a specific warning: (e.g. warning CS0649)

 #pragma warning disable 649 
+7
source

All Articles