Teamcity is selected for the following reasons:
This software is free for small teams.
Ø the installation and configuration are relatively simple, and the system requirements are not very high (compared with vs 2010 TFs)
Ø usage and configuration are simpler than cc.net
Contains duplicatesCodeDetection and analysis tools
I. SVN Installation
SVN service installation http://www.visualsvn.com/files/VisualSVN-Server-2.1.7.msi
SVN Client
Tortoisesvn
VisualSVN-2.0.5.msi
Ii. teamcity Installation
Http://www.jetbrains.com/teamcity/ download TeamCity-6.0.3.exe
Iii. teamcity practice
The following is a brief summary of multiple aspects involved. You can try the specific content or download the code content analysis of the book from the reference. General projects do not involve all of them either. You can simply cut down the items based on the project conditions and content.
1. Establish a CI Project
The default CI management URL is at http: // localhost/
Follow the prompts to create a project.
After successful creation, various types of build can be created.
2. nunit and coverage test
Teamcity comes with built-in functionality for ncover and partcover. To use partcover, you have to set it up on the build configuration page.
First, enable nunit tests (mark the flag in new unit test settings). Set it to run the tests from
% SYSTEM. teamcity. Build. workingdir % \ cidotnet. Calc. Test \ bin \ release \ cidotnet. Calc. Test. dll.
Go to the. NET Coverage Section, choose partcover from the drop-down list, and provide the path to the executables In the lib directory
(% SYSTEM. teamcity. Build. workingdir % \ Lib \ partcover \ partcover.exe ).
Report XSLT:
C: \ Program Files (x86) \ partcover. Net 4.0 \ XSLT \ report by Assembly. XSLT => partcover.assembly.html
C: \ Program Files (x86) \ partcover. Net 4.0 \ XSLT \ report by class. XSLT => partcover.class.html
Method of partcover execution in 64-Bit mode
Corflags.exe partcover.exe/32bit +/Force
3. mstest test msbuild form
<Project defaulttargets = "test" xmlns = "http://schemas.microsoft.com/developer/msbuild/2003">
<Propertygroup>
<! -- Default configuration -->
<Configuration condition = "'$ (configuration)' ='' "> debug </configuration>
<! -- Default platform -->
<Platform condition = "'$ (Platform)' ='' ">" any CPU "</platform>
<! -- Visual Studio path -->
<Vspath condition = "'$ (vspath)' ='' "> % ProgramFiles (x86) % \ Microsoft Visual Studio 10.0 \ common7 \ ide </vspath>
<! -- Asseblies to test -->
<Testassemblies> cidotnet. Calc. Test \ bin \ $ (configuration) \ cidotnet. Calc. Test. dll </testassemblies>
</Propertygroup>
<Target name = "build">
<Msbuild targets = "clean; rebuild" projects = "cidotnet. sln" continueonerror = "false"/>
</Target>
<Target name = "test" dependsontargets = "build">
<Delete condition = "exists ('mstestreport. trx')" files = "mstestreport. TRX"> </delete>
<EXEC command = "& quot; $ (vspath) \ mstest.exe & quot;/testcontainer: $ (testassemblies)/resultsfile: mstestreport. TRX"/>
<Message text = "# teamcity [importdata type = 'mstest 'path = 'mstestreport. trx']"> </message>
</Target>
</Project>
4. mstest
Mstest.exeCommand line options
Http://msdn.microsoft.com/zh-cn/library/ms182489.aspx
·Build log
[16:26:40]:Test settings: Local
[16:26:42]:# Teamcity [importdata id = 'mstest 'file = 'd: \ PM \ teamcity \ buildagent \ work \ eea58b62b6f4c74d \ mstestreportx. trx']
[16:26:42]:Importing data from 'd: \ PM \ teamcity \ buildagent \ work \ eea58b62b6f4c74d \ mstestreportx. TRX 'with 'mstest' Processor
[16:26:42]: Mstest
[16:26:42]:[Mstest] found 1 test definitions.
[16:26:42]:[Mstest
Find the mstestreportx. TRX file. Open vs to view the coverage rate.
5. integration tests
Unlike unit tests, we try to minimize the associations between components. dependent components are simulated using the mock framework.
Introduce related dependent components and replace mock.
6. other tests
Use the example code in Chapter 7th of the book for Reference
Involved:
WhiteFramework
Cidotnet. wincalc. Test: winform Test
Cidotnet. silverlightcalc. Test: Silverlight Test
SeleniumFrameworkHttp://seleniumhq.org/
Cidotnet. webcalc. Test
8. Code specifications
This part mainly modifies the project file, supports build, and then provides information feedback. For specific settings, refer to the following.
Fxcop
Use fxcop project for integration, *. fxcop is a project file
<Target name = "analyze">
<Delete condition = "exists ('fxcopreport. xml')" files = "fxcopreport. xml"> </delete>
<Fileupdate files = "cidotnet. fxcop" RegEx = "bin/debug" replacementtext = "bin/$ (configuration)"/>
<EXEC command = "tools \ fxcop \ fxcopcmd.exe/Project: cidotnet. fxcop/out: fxcopreport.html/axsl"/>
<Error condition = "exists ('fxcopreport. xml')" text = "fxcop found some broken rules! "/>
Define a new artifact fxcopreport.html and a new tab server configuration.
Stylecop
<Project defaulttargets = "analyze" xmlns = "http://schemas.microsoft.com/developer/msbuild/2003">
<Usingtask assemblyfile = "tools \ msbuildcommunitytasks \ msbuild. Community. Tasks. dll" taskname = "msbuild. Community. Tasks. fileupdate"> </usingtask>
<Usingtask assemblyfile = "tools \ msbuildcommunitytasks \ msbuild. Community. Tasks. dll" taskname = "msbuild. Community. Tasks. XSLT"> </usingtask>
<Usingtask assemblyfile = "tools \ msbuildcommunitytasks \ msbuild. Community. Tasks. dll" taskname = "msbuild. Community. Tasks. xmlread"> </usingtask>
<Usingtask assemblyfile = "tools \ stylecop \ microsoft. stylecop. dll" taskname = "stylecoptask"/>
<Createitem include = "cidotnet. Calc \ ** \ *. cs">
<Output taskparameter = "include" itemname = "stylecopfiles"/>
</Createitem>
<Stylecoptask
Projectfullpath = "$ (msbuildprojectfile )"
Sourcefiles = "@ (stylecopfiles )"
Forcefullanalysis = "true"
Treaterrorsaswarnings = "true"
Outputfile = "stylecopreport. xml"
Cacheresults = "true"
Additionaladdinpaths = "tools \"
/>
<XSLT inputs = "stylecopreport. xml"
Roottag = "stylecopviolations"
XSL = "tools \ stylecop \ stylecopreport. XSL"
Output = "stylecopreport.html"/>
<Xmlread XPath = "count (// violation )"
Xmlfilename = "stylecopreport. xml">
<Output taskparameter = "value" propertyname = "stylecopviolations"/>
</Xmlread>
<Error condition = "$ (stylecopviolations)> 0" text = "stylecop found some broken rules! "/>
Add the artifact file, and a new tab appears in the build Report page
Code already exists
Its purpose is to find the places in your code where your team has duplicated the code.
The duplicates finder is a separate build runner in teamcity.
9. Documentation
Sandcastle-based format
<Target name = "document">
<Msbuild projects = "cidotnet. shfbproj"/>
</Target>
Teamcity project's general settings, and set the artifacts path
Help/**/* => help
This causes all the help folder content from the current build to be copied to the help artifacts folder. to make the documentation visible on the Build-Report page, add a new tab in the server configuration, pointing to/help/index.html.
10. installation and deployment
Wix Installation
Clickonce deployment
Deploy MS
<Target name = "setup">
<Exec
Command = "& quot; $ (vspath) \ devenv.exe & quot; cidotnet. SLN/build & quot; $ (configuration) & quot;/Project cidotnet. wincalc. setup \ cidotnet. wincalc. setup. vdproj"
Continueonerror = "false" ignoreexitcode = "true"
/>
<Msbuild projects = "cidotnet. wincalc. Wix \ cidotnet. wincalc. Wix. wixproj" properties = "wixtargetspath = $ (msbuildprojectdirectory) \ tools \ Wix \ wix2010.targets;"/>
</Target>
<Target name = "publish">
<Msbuild targets = "publish" projects = "cidotnet. sln "continueonerror =" false "properties =" applicationversion = $ (Major ). $ (minor ). $ (build ). $ (revision) "/>
</Target>
<Target name = "webpublish">
<Msbuild targets = "package" projects = "cidotnet. webcalc \ cidotnet. webcalc. csproj "continueonerror =" false "properties =" packagelocation = webpublication \ package.zip; msbuildextensionspath32 = .. \ tools "/>
<Exec
Command = "cidotnet. webcalc \ webpublication \ package. Deploy. CMD/y/M: CI1/u: Administrator/P: marcinq1p0w2"
Continueonerror = "false" ignoreexitcode = "true"
/>
</Target>
11. Database Integration
This is mainly done using the database project of.
<Msbuild
Projects = "$ (solutionroot) \ nwsandbox. dbproj"
Properties = "configuration = debug; targetdatabase = newdbname"
Targets = "deploy"/>
Iv. References
Download cii.n_sourcecode.zip from the book continuous integration in. Net http://www.manning.com/kawalerowicz/
Including vs build scripts. For continuous integration of TFS, see
Http://www.cnblogs.com/2018/category/300477.html