views:

108

answers:

4

To prevent using some members (or type) there is a way to mark them as obsolete (and sometimes in the future remove them completly).

But is there a way to deprecate members (or types) of the compiled third-party assemblies? Or, at least, to make sure (or to issue a warning) when they are used?

+3  A: 

Have you considered crafting a custom Code Analysis/FxCop rule?

Daniel Pratt
If only making a custom CA rule were easier (and *officially* documented!). But this is the right idea...and you are using CA on a regular basis, right?
Dan
CA warnings can be suppressed.
Michael Damatov
A: 

You could use NDepend for this as well

Sam Saffron
A: 

I suppose you could subclass the entire library (or at least the parts you use) and then deprecate them any way you like.

le dorfier
The types could be sealed, could be interfaces, etc. Even for virtual methods, it wouldn't affect the caller unless they were changed to refer to your sub class, etc. In short, I'm not sure this is viable.
Marc Gravell
The other side of it is taht it's not your software; it may have lots of version dependencies that you don't anticipate; and if you could impose arbitrary deprecation attributes without your own signature on them, then inevitably you would end up eventually conflicting something from the publisher.
le dorfier
+2  A: 

As you can tell from the answers so far, there isn't a great, built-in way to do this.

Dustin Campbell