Build/Test Issues

Code Analysis Errors from NCrunch tests

Started by swd120 on 5,121 views

I'm using VS 2017 - 15.3.5 and getting code analysis errors across my solution even though code analysis is set to False in NCrunch settings.

External image

External image

How can I get the style rules to be ignored? I assume this is because Roslyn analyzers are embedded in the projects?

I also attempted to run under a different build configuration which explicitly excludes code analysis from the build - but ran into a separate set of issues doing that.

Hi,

The easiest way is to edit your project file. Search for the location of the StyleCop analyzers add-in and add " Condition="'$(NCrunch)' != '1'" " to the <ItemGroup>

Eg.

<ItemGroup Condition="'$(NCrunch)' != '1'">
<Analyzer Include="..\Solution\packages\StyleCop.Analyzers.1.1.0-beta004\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\Solution\packages\StyleCop.Analyzers.1.1.0-beta004\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>

Best regards,
Ralf

Post a reply

Log in to reply.