Force the usage of an attribute on properties, if they already have another attribute

Unfortunately you cannot generate custom compiler warnings from attributes. Some attributes like System.ObsoleteAttribute will generate a warning or error, but this is hard-coded into the C# compiler. You should find another solution to your problem, maybe letting Some3rdPartyAttribute inherit from RequiredAttribute?

Otherwise you have to change the compiler.


Another option is using some AOP techniques. Like for example:

PostSharp.

Using it you can at compilation analyze yur code and emit a error if some condition does not sutisfies your requirements.

For concrete example on attributes, can have a look on :

PostSharp 2.1: Reflecting Custom Attributes