Download StyleCop
http://code.msdn.microsoft.com/sourceanalysis
Setting Up StyleCop MSBuild Integration
http://blogs.msdn.com/sourceanalysis/pages/source-analysis-msbuild-integration.aspx
========Extract============
This will cause the StyleCop binaries and supporting MSBuild targets files to be installed under the {Program Files}/MSBuild/Microsoft/StyleCop folder.
Adding the Import Tag
Once the StyleCop MSBuild files are installed, the next step is to import the StyleCop targets file into your C# projects. This is done by adding an Import tag to each C# project file.
For example, to integrate StyleCop to the project SampleProject, open the project file SampleProject.csproj within your favorite text editor. Scroll down to the bottom of the file and add a new tag to import the Microsoft.StyleCop.targets file. This import tag should be added just below the import of Microsoft.CSharp.targets:
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">Save the modified .csproj file. The next time you build this project either within Visual Studio or on the command line, StyleCop will run automatically against all of the C# source files within the project.
...Contents Removed...
<Import Project="$(MSBuildBinPath)/Microsoft.CSharp.targets" />
<Import Project="$(ProgramFiles)/MSBuild/Microsoft/StyleCop/v4.3/Microsoft.StyleCop.targets" />
...Contents Removed...
</Project>
=========================