I am planning to use StyleCop in my project. My requirement is that the project should not get compiled when StyleCop returns a warning. Nor debugging should be possible.
I have already integrated StyleCop into MSBuild as described at http://blogs.msdn.com/b/sourceanalysis/archive/2008/05/24/source-analysis-msbuild-integration.aspx. It is throwing errors when I build. But, when I start debugging, it is possible (Means, it is possible for programmer to override StyleCop). I can see that the build process is not getting cancelled and all dlls are created.
Is it possible to cancel the build when StyleCop throws errors ?
Thanks,
Madhu
to show warnings of StyleCop as errors you can add next line into your *.csproj file:
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
to avoid compiling with stylecop errors you can use StyleCop's target just adding a line into same project file:
<Import Project="$(SolutionDir)\LOCAL_PATH\Microsoft.StyleCop.targets" />
After adding this line you will not compile project with StyleCop warnings(errors).
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