I want to raise warnings, if certain properties are used in the code. I could use the obsolete-attribute. But the used properties aren't obsolete, thus it wouldn't be that correct to give an obsolete warning. How can I define own warnings for some properties that are printed during compilation, when the property is used?
Asked
Active
Viewed 1,130 times
2
-
Attributes are meta data - the obsolete attribute is one the compiler knows about and issues the warning. To get what you want, you will need to both create a custom attribute and built the tooling that will inspect the codebase for it and issue the warning. – Oded Nov 26 '12 at 16:22
-
not an answer because I'm not 90% sure you can get this done at compile time, but you can definitely [write your own FxCop rules](http://stackoverflow.com/questions/366095/creating-a-custom-rule-in-fxcop) that will do this sort of thing. – hometoast Nov 26 '12 at 16:23
-
2Found this in another thread, it may do the trick: http://stackoverflow.com/a/154254 – Rui Jarimba Nov 26 '12 at 16:23
-
FxCop or some other static analysis tool the way to go – Matt Randle Nov 26 '12 at 16:29
1 Answers
1
- Why not use the obsolete atrribute?
- You can use task list with comments. Just use of the keywords defined here

John Alexiou
- 28,472
- 11
- 77
- 133
-
**Doh**. I know it is supposed to be `17*23` and not `17*24` but that is beyond the point for this posting. – John Alexiou Nov 26 '12 at 16:43