NDepend is a commercial tool (with the release of Open Source / Academic Edition) that can do all kinds of analysis for you. Although for some rules it overlaps with FxCop, it still has many functions.
I believe you can create a code analyzer from scratch
Everything is possible, but it takes a lot of time to write any validation tool that has any meaning. If your boss pays you for software development, you will burn his money. Writing your own analyzer is a good exercise, but it will also be a waste of time.
source share