Is there anyway to run all StyleCop rules from a unit test (equivalent to rescan all) and assert based on warnings?
Thanks in advance!
/Jasper
Technically, you can do it, but it is very (!) unusual way of using StyleCop.
First, you should learn how to run StyleCop from the code. This discussion contains some examples that can help implementing this: http://stylecop.codeplex.com/discussions/220546.
Then, you will be able to create unit-test that will enumerate and check all source files in specified location. The bad part here is that you will need to specify this location somehow, and unit-test will work with source codes instead of compiled assembly (which is rather untypical).
But anyway, I would recommend reconsidering your approach. It is not really required to consider StyleCop error as compilation errors. You could perform analysis on build-server and share the results in any way you like (the same thing about unit-tests) - everything in your hands!