This project is read-only.

ViolationCount parameter error when integrated into build

Sep 6, 2012 at 10:35 AM


I have integrated StyleCop into the build process by using the import project syntax in the csproj file. This works perfectly on my machine and reports all stylecop errors as warnings in the visual studio window.

I have commited the StyleCop.targets file and the csproj to our source control and now when another developer gets and tries to build the project he gets the following error:

The "ViolationCount" parameter is not supported by the "StyleCopTask" task. Verify the parameter exists on the task, and it is a gettable public instance property.              

We are both runnint Win 7 64bit with the same version of StyleCop installed using all the default install options.

I would be grateful of any suggestions as to what could be wrong as I would love to keep stylecop integrated.

Thanks, Jon.

Sep 6, 2012 at 3:11 PM
Edited Sep 6, 2012 at 3:11 PM

ViolationCount is a property on the StyleCopTask that was added in the last release. It suggest you've an old version of StyleCop.dll being loaded somewhere.

Sep 25, 2012 at 7:59 AM

I'm having the same error, and it's quite strange. I can't seem to figure out the cause.

We have the latest stylecop installed on our development machines. Analysis runs fine if launched by the IDE integration.

Then we installed the nuget package StyleCop.MsBuild in our solution projects and when building we get that error:

"The "ViolationCount" parameter is not supported by the "StyleCopTask" task. Verify the parameter exists on the task, and it is a gettable public instance property."

I tried to do the same steps on a machine without Stylecop installed and it works fine.

What steps can I try to solve this problem?


Jan 24, 2013 at 2:27 AM

Try this. I got this error in one project where in my ..csproj file I had the following:

  <Import Project="...\SomeOtherFile.Targets" />
  <Import Project="...\Microsoft.CSharp.Targets" />
  <Import Project="...\Stylecop.Targets" />

When I changed the order so that Microsoft.CSharp.Targets was first (as it was in all my other projects), the error went away.

<Import Project="...\Microsoft.CSharp.targets" />
<Import Project="...\SomeOtherFile.Targets" />
<Import Project="...\Stylecop.Targets" />

Your mileage may vary...

Feb 28, 2013 at 4:03 PM
I got this when an ealier version of the stylecop MSI had been installed and later versions of the dlls had been retrieved from NuGet. The solution was to uninstall the old package through windows "add/remove programs" or "progams and featues" and then reinstall the correct MSI.