现在的位置: 首页 > 综合 > 正文

CruiseControl.Net Setup Constructions,CruiseControl.Net安装流程(NUnit+FxCop+NCover+NDoc+Fitness)

2018年04月06日 ⁄ 综合 ⁄ 共 9223字 ⁄ 字号 评论关闭
 

 

CruiseControl Setup Constructions

 

Server side configuration

System require

IIS and .Net Framework 2.0, source control server (svn) at some where

1 setup CruiseControl

Just click next, next… finish.

2 config dashboard

Visit http://localhost/ccnet/ check that you get the follow screen.


 

If there is some problem saying that you do not have access to iis meta data, just reinstall the asp.net 2.0 ,you can run the commands

1 uninstall “%windows%/Microsoft.NET/Framework/v2.0.50727/aspnet_regiis.exe” –u

2 install “%windows%/Microsoft.NET/Framework/v2.0.50727/aspnet_regiis.exe” –i

 

 

3 setup TortoiseSVN & Subversion

I recommend you install TortoiseSVN version 1.3, in this document we use the setup package” TortoiseSVN-1.3.2.5840-client-1.3.0.msi”

After the installation, you need to restart your machine as recommended.

To make sure subversion works with the TortoiseSVN properly, we use subversion version 1.3, we use the setup package “svn-1.3.1-setup.exe”

Notice :the version of TortoiseSVN & Subversion should be properly, or subversion will throw exceptions during building saying that some of the command arguments are not supported.

 

 

4 Get Source Code from the server

Get the source code as the TortoiseSVN documentation tells you. In this case we check out the source code in C:/svn

 

5 check the svn works fine with TortoiseSVN

In command line ,you type “svn update C:/svn”

You will see the following screen if you have files to update from the server

 

If you have already got the newest version, you will only got the following message

 

If you can’t retrieve files or you got error messages, you need to reinstall the svn and TortoiseSVN.

6 add user define logger assembly

CruiseControl need one assembly “ThoughtWorks.CruiseControl.MSBuild.dll” to work with MSBuild to produce styled results, so you need copy it to working folder of each project or set it explicitly in the MSbuild section as follow:
<logger>C:/Program Files/CruiseControl.NET/server/ThoughtWorks.CruiseControl.MsBuild.dll</logger>

.

7 setup NUnit

Set up NUnit, make sure that you have the same version of NUnit assembly file, notice that NUnit assembly has strong name.

Sometime you have to make a project file (*.nunit) to gather all the assembly that you want to test, and make sure to set the config file to let the assembly get the right configurations.

8 setup FxCop

If you just want analyze only some file with the default rules, just go to the next step.

If you want to customize the rules and define different targets to analyze, you can set up a FxCop project and do all the customization, and save.

 

9 Setup NCover

NCover is used to measure test coverage, just set up the package, you will get a console application, this is the basic format for execute the program :

NCover.Console.exe nunit-console.exe c:/UnitTest.nunit //w c:/Coverage //x c:/Coverage/ncoverresult.xml /nologo</buildArgs>

Notice that the arguments need two‘/’ not one, and those arguments that start with one ‘/’ will be send to nunit.

 

10 Setup NDoc

NDoc is used to generate help file for your solution, based on the xml files generated by vs2005, so you need to add configuration to all project just as follow:

 


You should also setup a project file to get all the assemblies and xml files together, and it will simplify CruiseControl configuration. NDoc  Open Source Project is now stopped

11 config the CruiseControl

The configuration file is in the directory of /CruiseControl/server, named ccnet.config. You can find most of the instructions in the /CruiseControl/doc or you can visit http://ccServer/ccnetdoc/.

 Now we begin with the following steps:

            Config project

            Config source control

            Config msbuild

            Config nunit

            Config fxcop

            Config NCover

           

This is the file in this case

<cruisecontrol>

<project name="project1">

                                <labeller type="dateLabeller">   

                                </labeller>

                                <triggers>

                                                <intervalTrigger seconds="300" buildCondition="ForceBuild"/>

                                </triggers>

 

                                <webURL>http://localhost/ccnet/</webURL>

                                <sourcecontrol type="svn">

                                                <trunkUrl>svn://serveraddress /svnrepository</trunkUrl>

                                                <workingDirectory>C:/svny</workingDirectory>

                                                <username>builder</username>

                                                <password>svnpwd</password>

                                                <autoGetSource>true</autoGetSource>

                                                <tagOnSuccess>false</tagOnSuccess>                                   

                                                <executable>C:/Subversion/bin/svn.exe</executable>

                                </sourcecontrol>

 

                                <tasks>

                                                <msbuild>

                                                                <executable>C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/MSBuild.exe</executable>

                                                                <workingDirectory>C:/svn/Client Server Applications/MainForm.Presentation</workingDirectory>

                                                                <projectFile>Fastenal.sln</projectFile>

                                                </msbuild>

 

                                                <nunit>

                                                                <path>C:/Program Files/NUnit-Net-2.0 2.2.8/bin/nunit-console.exe</path>

                                                                <assemblies>

                                                                <assembly>C:/svn/Client Server Applications/MainForm.Presentation/bin/Debug/UnitTest.dll</assembly>                                            

                                                                </assemblies>

                                                                <outputfile>C:/svn/Client Server Applications/MainForm.Presentation/bin/Debug/test.result.xml</outputfile>

                                                </nunit>

 

                                                <exec>

                                                <executable>fxcopcmd</executable>

                                                <buildArgs>/f:"C:/svn/Client Server Applications/Address.Model/bin/Debug/Address.Model.dll" /o:c:/FxCopResults.xml</buildArgs>

                                                </exec>

 

<exec>

                                                <executable>C:/Program Files/NCover/NCover.Console</executable>

                                                <buildArgs>nunit-console.exe c:/UnitTest.nunit //w c:/Coverage //x c:/Coverage/ncoverresult.xml /nologo</buildArgs>

                                                </exec>

                                                <merge>

                                                <files>

                                                <file>c:/FxCopResults.xml</file>

                                                <file>c:/Coverage/ncoverresult.xml</file>

                                                </files>

                                                </merge>

 

                                </tasks>

                </project>               

</cruisecontrol>

Notes:

1 <labeller type="dateLabeller"/>    this is the label that works fine at most time, others like defaultlabeller don’t work so nice. You may receive some exceptions.

2 we should copy the ThoughtWorks.CruiseControl.MSBuild.dll to the work folder to help MSbuild generate the log info.

3 when we add NUnit task, we need to copy the config file of the NUnit project to the same folder that the test assembly located, or you can set it in the NUnit project file *****.nunit.

4 When we add fxcop task, we should make sure the target assembly files can find the reference assemblies.

5 the NCover ‘s XSL file that cruisecontrol included is not the latest one, and it can’t display full information, so you should replace it with the file at X:/Software/Build/CruiseControl.ConfigFile/ NCover.xsl.

 

 

12 config dashboard

 

As you can see in the diagram, the reports is generated by other application, and integrated in the dashboard, it can be customized though modifying the configuration file “ dashboard.config ”.

 

A NDoc Report config

Here we want to add one link to the chm file generated by NDoc. Here are the steps:

1 add one xml node in the “dashboard.config”

 <xslReportBuildPlugin description="NDoc" actionName="NDoc" xslFileName="xsl/NDoc.xsl"/>        at <buildPlugins> section.

2 copy X:/Software/Build/CruiseControl.ConfigFile /NDoc.xsl to %DashBoard%/xsl/

3 restart IIS and you will see some report called NDoc added in ccnet

.

B Fitness Report config

Fitness can generate html files as result, and we put it in the xml report file, and we use merge file in CruiseControl, it will be merged to the log file,Notice it should be stored in the CDATA section. And in the XSL file(X:/Software/Build/CruiseControl.ConfigFile / PaulFit.xsl), we just display the information.

 

If there are no errors in you configuration file, you can now start the CruiseControl program, and you will get the following screen, indicate that you have one project called “fsm” in process now.

 

 

 

 

The use of dashboard

Visit  http://ccserver/ccnet/, and you will find how to use it.

Client Setup

Visit the site http://ccserver/ccnet/, on the up-left corner, you will find Download CCTray, you just download the application and run.

After the installation, you have to do some configuration to let it work with the server. Right click the icon in the tray, and click setting.

 

 

Click Add, you will see the add project screen

 

 

Click Add Server

 

 

Select the first “Via the CruiseControl.Net dashboard” and type http://ccserver/ccnet/ in the textbox, click ok.

 

Then you will get the project list, you select the project and click ok.

 

 

And then in your CCTray status window you will see the state of the project building.

 

 

Note: if you try to force build some project in CCTray, you will receive an error saying it’s not supported.

 

抱歉!评论已关闭.