I would like to detect breaking changes in .NET code (specifically C#) whenever TFS builds a solution. If there are any breaking changes (such as outlined in "A definite guide to API-breaking changes in .NET") between the code being checked in and the version in the most recent successful build, I would like to know about it. A breaking change needn't cause the build to fail. Short of writing an app that uses reflection to compare two versions of the same assembly, how can this be done?
To elaborate a bit on James and Adam answers, I'd like to provide details concerning detecting breaking changes with NDepend and its code query and rule capabilities. Disclaimer: I am one of the developers of the tool
NDepend has evolved and its query language as well. If you download NDepend trial and analysis the two versions of your code base where you'd like to search for breaking change, have a look in the default code rules group API Breaking Changes for the following CQLinq rules.
Executing one of these code rule looks like for example (diff between NUnit v2.5.8 and v2.5.3):
Yes, I would (and do) use NDepend for this. I work on a product which provides an extendable API for developers. As such we need to make sure that between releases, we do not remove functionality that those developers may depend on. The flip-side, is that we need the flexibility to grow the product without massive constraints around reversioning.
Some things you will want to consider.
Unit tests. They provide a way to assert 'this is what client code expects'. You can have TFS run unit tests when you build.
Patrick Smacchia of NDepend fame posted about this ~3.5 years ago.
http://codebetter.com/patricksmacchia/2008/01/20/avoid-api-breaking-changes/
He mentions LibCheck and (obviously) NDepend, and a comment mentions one more.
Since it's been 3.5+ years since, there may be better options available these days (LibCheck is well over 6 years old), but those should be a start.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With