AspBucket offers ASP.NET, C#, VB, Jquery, CSS, Ajax, SQL tutorials. It is the best place for programmers to learn

Tuesday 2 May 2017

How to integrate style cop in the project?

In this article I am going to discuss How to integrate style cop in the project? Please read the below content to enable the style cop in project.
Open Visual studio Open Package Manager Console from TOOLS > LIBRARY PACKAGE MANAGER menu
install-package stylecop.msbuild

The above command will download the latest stable required dlls and files and integrate style cop with your project. Build your project and any style-cop errors will be shown in the warnings section.

Now style cop is enabled in your project if you want to build solution successfully if all the style cop issues are fixed. Then you need to make changes in the project file ( .csproj).

Open the .crproj file in the notepad and find the first PropertyGroup section within the file add 
in the file. for example:
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see The missing file is {0}.</ErrorText>
    <Error Condition="!Exists('..\packages\StyleCop.MSBuild.\build\StyleCop.MSBuild.Targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\StyleCop.MSBuild.\build\StyleCop.MSBuild.Targets'))" />

Now project will be successful if you fixed all style-cop issues.


Post a Comment

  • Popular Posts
  • Comments