StyleCop Integration with csproj and MSBuild.
Step 1. Install StyleCope 4.7
Step 2: Update .csproj by adding
<Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.7\StyleCop.Targets" />
----------------
</Project>
Step 3: Add the below Tag under <PropertyGroup> to Treat Stylecop Warnings as Errors
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
</PropertyGroup>
Step 4: By default, the "Merge with settings file found in parent folders" option is selected. StyleCop will continue searching above the current directory for additional parent settings files.
Step 1. Install StyleCope 4.7
Step 2: Update .csproj by adding
<Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.7\StyleCop.Targets" />
----------------
</Project>
Step 3: Add the below Tag under <PropertyGroup> to Treat Stylecop Warnings as Errors
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
</PropertyGroup>
Step 4: By default, the "Merge with settings file found in parent folders" option is selected. StyleCop will continue searching above the current directory for additional parent settings files.
Step 5: Rather than merging with a settings file
found within a parent directory, it is also possible to provide an explicit
link to another settings file to merge with.
Step 6: Build csproj with
MSBuild:
NOTE: If we are implementing
Stylecop, we should edit all csproj before building the same. also there is no
direct logging mechanism for StyleCop.
So Personally I will
recommend FxCop instead of StyleCop.