there are attributes in .NET (for example ) that can prevent compilation or at least throw warnings about compilation time depending on their configuration. ObsoleteAttribute
ObsoleteAttribute
How to write an attribute that can interfere with compilation? Is there any way to do this from outside Microsoft?
Obsoletethe attribute is "compiler magic" - you cannot do something like this yourself without changing the compiler. However, as always, there are workarounds - for example, look at this and this stream.
Obsolete
PostSharp: #
Any attributes that appear inside the compiler are special cases. The behavior is [Obsolete]described, for example, in the C # specification (17.4.3).
[Obsolete]
Can you write your own FxCop rule ?