Created
November 27, 2012 10:53
-
-
Save OdaShinsuke/4153608 to your computer and use it in GitHub Desktop.
MSBuild StyleCop Output XML => Jenkins Violation Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<UsingTask TaskName="ReplaceStyleCopResult" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> | |
<ParameterGroup> | |
<PATH ParameterType="System.String" Required="true" /> | |
<WORKSPACE ParameterType="System.String" Required="true" /> | |
</ParameterGroup> | |
<Task> | |
<Code Type="Fragment" Language="cs"><![CDATA[ | |
var content = File.ReadAllText(PATH); | |
File.WriteAllText(PATH, content.Replace(WORKSPACE, "../")); | |
]]></Code> | |
</Task> | |
</UsingTask> | |
<Target Name="OutputStyleCop"> | |
<!-- Create a collection of files to scan --> | |
<CreateItem Include=".\**\*.cs"> | |
<Output TaskParameter="Include" ItemName="StyleCopFiles" /> | |
</CreateItem> | |
<StyleCopTask ProjectFullPath="$(MSBuildProjectFile)" SourceFiles="@(StyleCopFiles)" ForceFullAnalysis="true" TreatErrorsAsWarnings="true" OutputFile="result\StyleCopReport.xml" /> | |
<ReplaceStyleCopResult PATH="result\StyleCopReport.xml" WORKSPACE="$(MSBuildProjectDirectory)" /> | |
</Target> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have made a small fix to create the result folder prior to copying the file into it. It can be found here:
https://gist.github.com/bangsholt/11bd08144a7a0e9e3929176bcee447c0
Thanks to OdaShinsuke for sharing in the first place :)