2

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?

dove
  • 20,469
  • 14
  • 82
  • 108
Konrad
  • 4,329
  • 10
  • 54
  • 88
  • 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
  • 2
    Found 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 Answers1

1
  1. Why not use the obsolete atrribute?
  2. You can use task list with comments. Just use of the keywords defined here VS2008 Options VS2008 Editor
John Alexiou
  • 28,472
  • 11
  • 77
  • 133