StyleCop in VS Express edition for "WebSite" projects

Jul 11, 2014 at 11:39 AM
Edited Jul 11, 2014 at 11:40 AM

Need some help to figure out how to get StyleCop working for "Web Site" projects in Express editions of Visual Studio.

I understand StyleCop can work in integration with paid editions of Visual Studio and can also work with MSBuild.

Since there is no .csproj file in "Web Site" projects, I dont know where to set StyleCop targets.

Please help.

Jul 12, 2014 at 1:00 PM
Edited Jul 12, 2014 at 1:01 PM
I have integrated the stylcops 4.7 with Visual Studio 2013 (Web) using following setps..
  1. In order to integrate StyleCop with a project, an <Import> needs to be added to the .csproj file (versions and paths might differ):
If you used the official installer and installed the 'MSBuild integration' component, your <Import> will look like this:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- Your StyleCop <Import> will go here --> <Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.7\StyleCop.targets" />

Note: You need add above line in each and every project in your solution
  1. Copy Settings.StyleCop in the project solution folder from C:\Program Files (x86)\StyleCop 4.7 on solution root folder or add as a solution item
  2. Dubble click the Settings.StyleCop file for configuring stylecops rules.
You should be able to use the stylecops in your project.

--Sandeep Yadav
Jul 14, 2014 at 9:49 AM
Hi Sandeep,

Thank you for the reply. That is useful information and would work for Web Application projects.

What I wanted to ask is - how to get StyleCop running with "Web Site" projects in Express editions of Visual Studio

a) Web Site projects do not have .csproj file.
b) Express editions do not support stylecop in visual studio tools menu.

Please help.