Doug Boone
Doug Boone

Reputation: 365

FxCop VS2013 Anyone know what a warning identifier is?

Upgrading from VS2010 to VS2013 we started getting this error when running static analysis:

"CA0001 Error Running Code Analysis CA0001 : A class that implements multiple rules must explicitly specify the warning identifier"

I've spent a few hours researching but haven't found anything about what this error means or how to fix it.

The CA0001 is just a generic error that FxCop doesn't like the rule, but what is a "warning identifier"? And why is this an issue with VS2013 but not VS2010?

Upvotes: 1

Views: 420

Answers (1)

Anton Georgiev
Anton Georgiev

Reputation: 620

I found that if I move the FxCop (Code Analysis) .targets reference BEFORE the Microsoft.CSharp.targets one that solves the problem for me.

And while we are on the topic, apparently the StyleCop .targets file needs to be loaded AFTER Microsoft.CSharp.targets for the StyleCop rules to be run at build time.

Example:

<Import Project="$(SolutionDir)\..\msbuild\CodeAnalysis\Microsoft.CodeAnalysis.Targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\..\msbuild\StyleCop v4.7\StyleCop.targets" />

Upvotes: 1

Related Questions