I am trying to get builds for crashes if they don't skip StyleCop. They are currently only displayed as warnings. I tried to follow the documentation here .
I added to my CSProj file <Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.7\StyleCop.targets" />
, which seems to include StyleCop correctly.
Then I added the StyleCopTreatErrorsAsWarnings
parameter to false in my csproj file. Here is the beginning of my CSProj file:
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.7\StyleCop.Targets" /> <PropertyGroup> <StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
This leads to warnings in Bamboo (my continuous integration server), but no errors. The same thing happens in Visual Studio.
Why are StyleCop errors still appearing as warnings?
source share