1. What is stylecop?
Stylecop is a static code analysis tool for developer to check the code style. and it seems similar to fxcop which is another static code analysis tool. stylecop can excute the Code with the special rule that is made by developer. you can use the rules to restrict code, such as: Documentation rule, layout rule, maintainability rule and naming rule.
2. Where to get stylecop?
You can get it:
Http://sourceforge.net/project/showfiles.php? Group_id = 241753 & package_id = 294249 & release_id = 636538 stylecopcmd 0.2.1
Http://code.msdn.microsoft.com/sourceanalysis/Release/ProjectReleases.aspx? Releaseid = 1425 stylecop 4.3.1.3 plugin
3. How to set up inviroment?
Stylecopcmd 0.2.1 is a tool for developer in integrated invrioment. To inmarshate stylecopcmd into project. Build and the following is an example:
<Target name = "stylecop" depends = "clean" Description = "Source code stylecop...">
<Delete dir = "$ {project. dir} \ stylecop" failonerror = "false"/>
<Mkdir dir = "$ {project. dir} \ stylecop" failonerror = "false"/>
<Exec program = "$ {stylecopcmd}" failonerror = "false" CommandLine = "-R
-SF $ {project. dir} \ sharepointarchivesolution. sln
-Of $ {project. dir} \ stylecop \ stylecopreport. xml
-TF $ {project. dir} \ build_scripts \ stylecop \ stylecopreport. XSL
-CS $ {project. dir} \ build_scripts \ stylecop \ Settings. stylecop "/>
</Target>
Note: The meanning of command:
Stylecopcmd [-?] [-CS <symbols>] [-D <dirpaths>] [-F <filepaths>] [-IFP <patterns>] [-of <filepath>] [-PF <filepaths >] [-R] [-SC <filepath>]
[-SF <filepaths>] [-TF <filepath>]
-?, -- Help print this help screen
-CS, -- configurationsymbols <symbols> Configuration symbols to pass to stylecop (ex. debug, release)
-D, -- directories <dirpaths> directories to check for CSHARP files
-F, -- files <filepaths> files to check
-IFP, -- ignorefilepattern <patterns> regular expression patterns that can be used to ignore files
-Of, -- outputxmlfile <filepath> the file the XML output is written
-PF, -- projectfiles <filepaths> Visual Studio project files to check
-R, -- recurse recursive Directory Search
-SC, -- stylecopsettingsfile <filepath> use the given stylecop settings file
-SF, -- solutionfiles <filepaths> Visual Studio solutions files to check
-TF, -- convert file <filepath> the transform File
See more infomation at this: http://blogs.msdn.com/sourceanalysis