Apply Microsoft stylecop in our project

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.