Midhun Murali
Midhun Murali

Reputation: 2151

Integrating Stylecop in Jenkins for .NET project

I have installed Jenkins on windows machine and it's building the .NET code properly. I have installed the Violations plugin in Jenkins to validate Style cop warnings . While building the solution the StyleCop validations are shown in the Jenkins console output page as below

  C:\Users\\\\Properties\AssemblyInfo.cs(32,1): warning : SP2000 : StyleCopPlus.StyleCopPlus :  Invalid spacing at the end of the line. [C:\Users\\\\\Midhun.csproj]

    1660 Warning(s)
    0 Error(s)

Time Elapsed 00:00:04.35 Finished: SUCCESS

But it's not showing any thing in the violations page.

I add the below in the .csproj

 <StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>

After that jenkins build was failing. But still violations page was coming emtpy.

I went through so many articles , but not able to clearly understand what need to be done. I could n't find any step by step tutorial for this . If anybody can post a step by step tutorial or a link that would be great help.

Upvotes: 2

Views: 3157

Answers (2)

Le Tin
Le Tin

Reputation: 9

Hope this help: **/*/StyleCopViolations.xml

Upvotes: 0

Midhun Murali
Midhun Murali

Reputation: 2151

I got this fixed . Below are detailed steps how to solve this issue.

  1. Add Violations plugin in Jenkins

  2. In post build steps add Report Violations .Specify where the stylecopviolations.xml file is generated.

This is file will be created jenkins workspace folder -> Application Folder -> Obj - > Debug - > Stylecopviolations.xml . So in the below section we need to specify as * / */ */ SyleCopViolations.xml .

  1. Now you will be able to see the stylecop violations in violations page

enter image description here

Upvotes: 2

Related Questions