开发者

StyleCop should cancel build. Is this possible?

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 poss开发者_如何学Goible.

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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜