简体   繁体   中英

Suppress warning without code

I am trying to suppress some warnings in Visual Studio, but the problem is that they don't have a code or anything I could use to identify them(or I can't find it).

Most of these errors look like "The referenced component could not be loaded" or 'cannot find custom tool on this system'.

Both these type of errors appear on the Error List tab from visual studio, but they don't appear in the Output tab, where I could see their' code also.

If anyone could give me some tips about how to suppress them, would be great.

It is still recommanded to solve warnings rather than suppressing them.

But if you are pretty much sure that things you have done that causes the warning is meaningful and logically correct, you can still suppress them.

Check the warning codes that Visual Studio generates and get rid of the CS prefix

Add the following code into your .csproj file within a PropertyGroup tag (without Condition property)

<NoWarn>THE_WARNING_CODE</NoWarn>

If you wish multiple warning codes to be suppressed, separate them by semicolon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM