Wednesday, September 29, 2010

Conginuous Integration

Just performed continuous integration using Teamcity.
http://www.jetbrains.com/teamcity/ab_index.html
Its easy but complex, needs little understanding for novice users.
SVN is used with teamCity.
·         http://www.visualsvn.com/
watiN integration has shown good results.
http://watin.sourceforge.net/

Following document shows steps to configure teamCity.
I used dotnet 4.0
TeamCity (Version 1.0)
Document Date : August 26, 2010
Created By  : Imran Bashir

The Big Picture







TeamCity   Architecture

Download and install TeamCity from the following link;

  • Create New Project using TeamCity.
·         Enter Project Name and Description
o   Create Build Configuration
§  Enter Artifact Path.  Artifact is output of a build. Artifact path specifies which files to upload to the server after build e.g.  MSBuild/** (means  publish all files and folders inside MSBuild folder). Once these files are uploaded they become available for download.

·         Version Control Settings
o   Enter Unique Root Name and specify SVN Root Path e.g.  https://datum-130:8443/svn/TestRepo/TestProject
o   Enter UserName and Password of SVN
o   Perform Test Connection
·         Build Runner
o   Select Build Runner e.g. MSBuild, NAnt etc. (In my case I have used MSBuild)
o   Enter Build File Path e.g. MSBuild/build.xml (Path should be relative to checkout directory). Please  see build.xml file for more details about build script.  This build file must reside on SVN Sever, because Teamcity  always gets that file from SVN server.
o   Enter targets of the build file. E.g. ExecTest;TestCompile;Compile;Clean
o   Check Enable MSTest tests and enter path of MsTest.exe. Example;
D:\Program Files\Microsoft Visual Studio 10.0\VC\

·         SERVER CONFIGURATION
Click Administration link. Then click server configuration. Here you can manage users and groups. Also manage email settings etc.
o   Email Notifier
§  Following are email notifier settings that I have used while development.
                                Do not forget to perform Test Connection.
·         Enable Email Notification
Click on My settings and tools then click Edit Email Notifier. Perform Notification settings as desired.

·         TeamCity Addin for  Visual Studio
o   Click My Settings & tools
Addin for Visual Studio
·         Download and install Visual SVN on developer machine (this is required for TeamCity Addin for Visual studio)  http://www.visualsvn.com/

·         Run MSBuild from command prompt
Following command is used to execute MSBuild script file.
Open visual studio command prompt
msbuild D:\TESTREPO\TestProject\MSBuild\build.xml /t:Compile
where build.xml is the Build script file, Compile is the name of target to be executed.  See the build.xml file inside documentation folder.
More information regarding MSBuild is available here;
·         Run MSTest from command prompt
Open Visual Studio command prompt
MSTEST /testcontainer:D:\TESTREPO\TestProject\MSBuild\TestProject\bin\Debug\TestProject.dll


·        Teamcity SSL settings
The following is added to the TC config located in "C:\TeamCity\conf\server.xml":
 <Connector port="8443" maxHttpHeaderSize="8192"
   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
   enableLookups="false" disableUploadTimeout="true"
   acceptCount="100" scheme="https" secure="true" SSLEnabled="true"
   clientAuth="false" sslProtocol="TLS" useBodyEncodingForURI="true"
   keystoreFile="C:\TeamCity\dcs.allshoreresources.com.2011.01.26.pfx"
   keystorePass="**************"
   keystoreType="PKCS12" />



Fixing some errors on Dev machine
http://www.cynotwhynot.com/blog/post/MSBuild-missing-MicrosoftWebApplicationtargets.aspx
gtanetws\gtanetws.csproj (,): warning MSB4122: Scanning project dependencies for project "gtanetws\gtanetws.csproj" failed. The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the &lt;Import&gt; declaration is correct, and that the file exists on disk. C:\ccnet\projects\gtanetws\src\gtanetws\gtanetws.csproj
For some reason the download for the .NET Framework excludes this critical file that is necessary to build web applications. The solution is fairly simple;
1.   Go to a computer that already has Visual Studio installed. Make sure you use the correct version. For example, if you are using .NET Framework 3.5 then you will need to using Visual Studio 2008 (V9.0). The instructions assume you are using for .NET Framework 3.5 for the build server
2.   Copy all the files from the C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications to the server and place them in the same directory. You will need to create the directory tree on the server.
That's all there was to it. You should now be able to build web applications on your build server.

No comments:

Post a Comment