开发者

Suppress Compiler Warnings in VS2010

I'm trying to clear the warnings given when my solution compiles in VS2010. Curre开发者_如何学编程ntly 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.


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.


At the top of the file put:

#pragma warning disable

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

#pragma warning disable 649
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜