Tech and a few other things RSS 2.0
# Sunday, August 22, 2010




You wanna set up a continuous integration server for .net and you want to do it fast, problem is learning all the darn elements and what they do for a nant script (default.build) and for the Cruise Control script (ccnet.config), ugg what a pain. Well I'm here to help you. I just created these two scripts on a very basic level to help you get moving quickly, because who honestly wants to waste time setting these things up. I provided plenty of comments too and links in the scripts to websites to make this as painless and as quick as possible. 

Feel free to take and use and build upon, but remember to share and certainly don't snip it and play to your friends on how quickly you set it up and not tell them where you went. That's just not cool. Some might even say you're being a poser. :)
Cruise Control config file ccnet.config:

<!-- A great refrence website                                                -->
<!-- http://ilmatte.wordpress.com/2008/06/01/cruisecontrolnet-tutorial-part-1/#ccnettutsourcecontrolblock -->

<cruisecontrol>  
    <project name="testProject">  
        <!-- URL of web interface set up for cruise control                    -->
        <webURL>http://localhost:8080/default.aspx</webURL>  
        
        <!-- Directory of your project checked out from whatever            -->
        <!-- repository you use and build script is in                         -->
        <workingDirectory>C:\dev\ccnet</workingDirectory>  
        
        <!-- Directory of where all the build logs will be placed            -->
        <artifactDirectory>C:\develop\CCnet\project1CCnetArtifacts</artifactDirectory> 
        
        <!-- Hook for using Subversion                                                            -->                
        <!-- Parameter documentation for sourcecontrol plugin using svn:                          -->
        <!-- http://ccnet.sourceforge.net/CCNET/Subversion%20Source%20Control%20Block.html        -->
        <sourcecontrol type="svn">  
            <trunkUrl>http://win-r7ld6grk131:1234/svn/testproject/trunk/testapp</trunkUrl>  
            <workingDirectory>C:\dev\ccnet</workingDirectory>
            <executable>C:\csvn\bin\svn.exe</executable>
            <username>admin</username>  
            <password>admin</password>
            <timeout>60000</timeout>            
        </sourcecontrol> 
        
        <!-- Hook for Git: Didn't spend to much time                         -->
        <!-- setting this up it may need some more tweeking                    -->
        <!-- and I'm not sure CC supports it natively yet                    -->
        <!--
        <sourcecontrol type="git">
            <repository>C:\repositories\examplerepository\TestApplication</repository>
            <branch>master</branch>
            <autoGetSource>true</autoGetSource>
            <executable>git</executable>
            <tagOnSuccess>false</tagOnSuccess>
            <tagCommitMessage>ccnet build {0}</tagCommitMessage>
            <workingDirectory>C:\repositories\examplerepository\TestApplication</workingDirectory>
            <timeout>60000</timeout>
        </sourcecontrol>
        -->
        
        <!-- How often it should check the repository for changes             -->
        <!-- Parameter documenation for triggers                             -->
        <!-- http://ccnet.sourceforge.net/CCNET/Interval%20Trigger.html     -->
        <triggers>  
            <intervalTrigger name="SVN" seconds="10" buildCondition="IfModificationExists" />  
        </triggers> 
        
        

        <!-- You can use MSBUILD instead of NANT because it can just build the     -->
        <!-- the solution file, as of right now you can't do that in NANT       -->
        <!-- for anything above Visual Studio 2003 Solution files              -->
        <!-- If you have any issues setting this up to build over a network 
        <!-- Look at these blog posts
        <!-- http://bencoffman.com/blog/2010/12/01/Error43AnErrorOccurredLoadingAConfigurationFileFailedToStartMonitoringChangesTo.aspx -->
        <!-- http://bencoffman.com/blog/2010/12/01/ASPNETCOMPILERErrorASPRUNTIMERequestFailed.aspx                                       -->
        <!--
        <tasks>
<msbuild>
<executable>c:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
<workingDirectory>\\vdev2\data\Inetpub\wwwroot\KSL\BartonCreek\</workingDirectory>
<projectFile>bartoncreek.sln</projectFile>
<buildArgs> /t:Rebuild /p:Configuration=Debug</buildArgs>
<timeout>600</timeout>
</msbuild>
</tasks>
--> <!-- labels each build with my name on the front of the project name --> <!-- Parameter documenation for labeller at --> <!-- http://ccnet.sourceforge.net/CCNET/Default%20Labeller.html --> <labeller type="defaultlabeller"> <prefix>Bens-TestProject-</prefix> <incrementOnFailure>true</incrementOnFailure> </labeller> <!-- Runs the super sweet nant script you created --> <!-- there is an <exec> parameter for nunit tests OR --> <!-- You can just use <nunit>.....just saying --> <!-- Parameter documentation for task --> <!-- http://ccnet.sourceforge.net/CCNET/Task%20Blocks.html --> <tasks> <nant> <executable>C:\nant-0.90\bin\nant.exe</executable> <baseDirectory>C:\dev\ccnet</baseDirectory> <nologo>false</nologo> <buildFile>default.build</buildFile> <buildTimeoutSeconds>1200</buildTimeoutSeconds> <targetList> <target>build</target> </targetList> </nant> </tasks> <!-- The directory to copy to. A subdirectory called the current build's label will --> <!-- be created, and the contents of sourceDir will be copied to it --> <!-- http://ccnet.sourceforge.net/CCNET/Build%20Publisher.html --> <publishers> <buildpublisher> <sourceDir>C:\dev\ccnet\bin</sourceDir> <publishDir>C:\Builds\</publishDir> </buildpublisher> </publishers> </project> </cruisecontrol> nant build script default.build: <?xml version="1.0"?> <!-- Good Reference site for the new comers --> <!-- http://ondotnet.com/pub/a/dotnet/2003/01/27/nant.html --> <project name="Bens Test Project" default="run" basedir="."> <!-- REMEMBER:!! as of version .90 nant only supporst building of --> <!-- Visual Studio 2002 and 2003 Solution files --> <!-- Builds your code and creates a bin directory to put your --> <!-- library's (assemblies) in --> <target name="library"> <mkdir dir="bin" /> <csc target="library" output="bin\testLibrary.LastNames.dll"> <sources> <!-- I used star here to compile all .cs files. --> <!-- Also I put a slash in so I could put my build file in --> <!-- The root solution folder and have it step into each --> <!-- project file and build all the code it then takes the --> <!-- library's (asseblies) and puts them in the --> <!-- root bin folder --> <include name="testLibrary/*.cs"/> </sources> </csc> </target> <!-- Builds your code and creates a bin directory to put your --> <!-- exe in --> <target name="build" depends="library"> <csc target="exe" output="bin\BensTestApplication.exe"> <sources> <!-- I used star here to compile all .cs files. --> <!-- Also I put a slash in so I could put my build file in --> <!-- The root solution folder and have it step into each --> <!-- project file and build all the code it then takes the --> <!-- exe and puts them in the --> <!-- root bin folder --> <include name="TestApplication/*.cs"/> </sources> <!-- classes I referenced in "BensTesdtApplication" are in --> <!-- this library --> <references> <include name="bin\testLibrary.LastNames.dll" /> </references> </csc> </target> <!-- Deletes the entire bin folder and all of its contents --> <target name="clean"> <delete dir="bin" failonerror="false"/> </target> <!-- Executes the exe your program built, --> <!-- This will not run if the "build" "target" fails --> <!-- <target name="run" depends="build"> <exec program="bin\BensTestApplication.exe"/> </target> --> </project>

Sunday, August 22, 2010 2:53:07 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
.Net | ccnet | nant
Navigation
About the author/Disclaimer
        

My name is Ben Coffman. Currently leading the release of native for iPhone and redefining how banking apps work for Capital One. I have a strong focus on mobile development, building effective development teams and a drive for rapid prototyping and continuous integration using nearly all SDLCs. When I turn the internet off I focus on my family, random hobbies, and sharing moments in life.

My pseudo proactive thoughts
--> Twitter @coffmanben

Learn About Me
--> Linkedin
--> StackOverflow

Blogs I follow:
  1. Big Nerd Ranch
  2. NS Hipster
  3. Scott Hanselman

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Ben Coffman

Archive
<August 2010>
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234
All Content © 2014,

Sign In