This project is read-only.

Can we run StyleCop on specific piece of c# code?

May 23, 2011 at 7:24 AM

Hi All,

Just a quick question on running StyleCop.

1. Instead of running StyleCop on entire project, is it possible to run the same on specific piece of C# code?


Jackson C.

May 23, 2011 at 5:57 PM

Hi Jackson,

In the current implementation, I'm afraid it's not directly supported.

As a workaround, you could consider creating a complete compilation unit from your piece of code, and checking this document afterwards.
For example, if you have a method you could create a dummy wrapping class containing this method.
There is no need making this class able to compile, because the only need for StyleCop is that your class can be parsed.

Best regards,
Oleg Shuruev

May 30, 2011 at 11:42 AM

Hi Shurdev, 

Thanks for your update. Will consider this workaround, it seems to be helpful. 



Jackson C.