Wednesday, May 7

Getting StyleCop to ignore temporary files.

I use StyleCop. I like it. With Visual Studio 2013, though, I found a few problems. Number 1 is that Express does not have extensions, so you must add the StyleCop extension to the project manually.

<import project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
<import project="$(ProgramFiles)\MSBuild\StyleCop\v4.7\StyleCop.targets"/>

StyleCop also complains the temporary files that Visual Studio generates do not have headers. There are a few ways to have it ignore these, but I found adding this to the project file works well in the Express version of Visual Studio.
<itemgroup>
  <excludefromstylecop include="$(IntermediateOutputPath)\**\*.cs">
  </excludefromstylecop>
</itemgroup>

No comments: