dbh
dbh

Reputation: 11

VS 2013 Run StyleCop Option

I have enabled StyleCop in VS2013 using following steps

  1. Installed StyleCop with command install-package stylecop.msbuild

  2. Updated below lines in .csproj file

    a. <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.7\StyleCop.targets" />

    b. <StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings> in first <PropertyGroup> of the .csproj file.

  3. Copy Settings.StyleCop in the project solution folder from C:\Program Files\StyleCop 4.7 on solution root folder or add as a solution item.
  4. Double click the Settings.StyleCop file as configure the rules. You should be able to use the stylecops in your project.

When I build the application, StyleCop functionality is working as expected. But when I right click on any project I don't see the option "Run StyleCop" or "Run StyleCop (Rescan All).

Can anybody help me on this ?

Upvotes: 1

Views: 465

Answers (1)

NikolaiDante
NikolaiDante

Reputation: 18649

The nuget package StyleCop.MSBuild simplifies the adding of the properties to a csproj required to run StyleCop as part of the build. It also references a StyleCop instance inside /packages/ which means that it is downloaded from sourcecontrol and each developer does not need StyleCop installed.

To get the context menus, you need to install StyleCop on your local machine.

Upvotes: 1

Related Questions