there are attributes in .NET (e.g. ObsoleteAttribute) which are able to prevent compilation or at least throw compile time warnings depending on their configuration.
Any attributes that exhibit this inside the compiler are special cases. The [Obsolete] behaviour is described in the C# spec (17.4.3), for example.
[Obsolete]
You could write a custom FxCop rule?