Agile development and continuous integration of fxcop in CruiseControl. NET

Source: Internet
Author: User

Next to the configuration file replacement (http://blog.csdn.net/lu_yongchao/article/details/7173630) for the previous automatic release, which primarily records the use of fxcop in cc.net.

Code Standard detection tool fxcop cannot be directly used by CC. net. I use executabletask in tasks.

The specific configuration method of cruisecontrol. netconfig is as follows:

<Tasks> <! -- Copy the modified SLN file --> <exec executable = "E: \ testspace \ ccnetgroup \ infomanager \ other \ coverslnfile. Bat"/> <! -- Compile SLN --> <msbuild> <executable> C: \ WINDOWS \ Microsoft. net \ framework \ v4.0.30319 \ msbuild.exe </executable> <workingdirectory> E: \ testspace \ ccnetgroup \ infomanager \ code </workingdirectory> <projectfile> infomanagerweb. SLN </projectfile> <buildargs>/P: configuration = debug/V: diag </buildargs> <timeout> 900 </timeout> <logger> D: \ Program Files \ cruisecontrol. net \ Server \ thoughtworks. cruisecontrol. msbuild. DLL </logger> <tar Gets> rebuild </targets> </msbuild> <! -- Compile *. wdproj execution release --> <msbuild> <executable> C: \ WINDOWS \ Microsoft. net \ framework \ v4.0.30319 \ msbuild.exe </executable> <workingdirectory> E: \ testspace \ ccnetgroup \ infomanager \ infomanager_deploy </workingdirectory> <projectfile> infomanagerweb_deploy.wdproj </projectfile> <buildargs>/P: configuration = debug/V: diag </buildargs> <timeout> 900 </timeout> <logger> D: \ Program Files \ cruisecontrol. net \ Server \ thoughtworks. cruis Econtrol. msbuild. dll </logger> <targets> rebuild </targets> </msbuild> <! -- Copy configuration file --> <exec executable = "E: \ testspace \ ccnetgroup \ infomanager \ other \ 82_config \ confilecopy. Bat"/> <! -- Unit test configuration and ncover configuration <nunit> <path> C: \ Program Files (x86) \ nunit 2.6 \ bin \ nunit-console.exe </path> <assemblies> <Assembly> D: \ qiuliangtest \ SRC \ CC. test \ bin \ debug \ CC. test. DLL </Assembly> </assemblies> <excludedcategories> <excludedcategory> longrunning </excludedcategory> </excludedcategories> <outputfile> D: \ qiuliangtest \ dailybuild \ nunit \ nunit-results.xml </outputfile> </nunit> <exec executable = "D: \ qiuliangtest \ ncover. ba T "/> --> <! -- Fxcop configuration, fxcop. bat content needs to be manually completed --> <exec executable = "E: \ testspace \ ccnetgroup \ infomanager \ other \ fxcop. bat "/> </tasks>

The content of the fxcop. BAT file is as follows:

"D:\Program Files\Microsoft Fxcop 10.0\FxCopCmd.exe" /project:E:\testspace\CCnetgroup\InfoManager\other\fxcop\default.FxCop /out:E:\testspace\CCnetgroup\InfoManager\other\fxcop\DailyBuild.FxCop.xml /q /gac

Note the following two points in the fxcop. BAT file:

1. "D: \ Program Files \ microsoft fxcop10.0 \ fxcopcmd.exe" must be enclosed in double quotation marks ,.

2 ,. fxcop file generation is as follows (note that when saving another file, the path is preferably under the same root directory of the DLL you want to check. During the test, it prompts that the file must be accessed by a relative path, therefore, the disk cannot be expanded ):

I copied a section about fxcop, which Baidu knows as follows:

Optional or. DLL file (excluding the netmodule file), which contains four types of information: Assembly List (including referencing external assembly, netmodule and resource file and Assembly contained in the same file ); type description information, including version information and class description; msil Microsoft intermediate language; resources (icons, etc.) for inspection. It uses a rule-based engine to check out the nonstandard parts of your code. You can also customize your own rules to add them to this engine. This tool is provided by Microsoft for free. The latest version requires. net.
2.0. In addition, there is an old version for. NET1.1.

The latest version of FxCop uses a technology called lift (introspection, or inner view and inner view) to snoop inside your assembly, while the previous version uses a ing (reflection, or reflection) technology. This is worth noting because you have to stop when debugging with the previous version. After making any changes to the Code, you need to re-debug the Code. These are not necessary for the new version.

Most code analysis tools scan your source code, but FxCop directly processes the compiled code .. Each assembly of NET has its metadata (metadata, which is the type information library of each element in an assembly. It is also stored in this assembly ), it describes all types used in assembly and assembly. FxCop uses this metadata to learn the running status inside the code. In addition, it also checks the MSIL (Microsoft Intermediate Language, Microsoft Intermediate Language) generated during code compilation.

Through the combination of metadata and MSIL checks, FxCop can produce a large amount of information to gain an understanding of what code is doing during execution. It compares your code and rules one by one. In each instance, a message is generated when the code that does not comply with the rules is found.

Next step: Learn about operations such as version backup during automatic release. Thank you.

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.