Reputation: 8516
In this article they recommend avoiding inclusion of suppressions like
[SuppressMessage("Microsoft.Design", "CA1039")]
in your release builds.
How is this accomplished (i.e. the suppression does its intended job, but it is not included in the release binaries)?
(context is Visual Studio 2017)
Upvotes: 0
Views: 76
Reputation: 1497
Try this
#if DEBUG
[SuppressMessage("Microsoft.Design", "CA1039")]
#endif
The code between #if DEBUG
and #endif
will only be executed if you run your programm in debug mode.
So it will be excluded in release builds.
Upvotes: 4