magritte
magritte

Reputation: 7636

How do you configure StyleCop to run for a specific build configuration?

I've added the following imports statement to the csproj file:

<Import Project="..\..\..\packages\StyleCop 4.7\StyleCop.targets" />

This work fine, however I only want the style cop analysis to run on Debug builds and not on Release builds. My Google Fu is failing me today, although I have found that you can create a console command line wrapper for StyleCopConsole and run it manually (http://stylecopplus.codeplex.com/wikipage?title=Running%20StyleCop%20from%20Your%20Code), I'd rather just edit the project files if that's possible so that it runs automatically on Debug builds.

Any idea if this is possible?

Thanks in advance!

Upvotes: 4

Views: 1650

Answers (1)

James Woolfenden
James Woolfenden

Reputation: 6661

You could conditionally import the targets

<Import Project="..\..\..\packages\StyleCop 4.7\StyleCop.targets" Condition="$(Configuration)=='Debug'"/>

Upvotes: 5

Related Questions