Making plugins for CCNet server or Dashboard

Contents

Steps:

  1. Create a Class Library project to build the assembly that will contain your custom builder plug-in. The assembly that it produces should be named: ccnet.*.plugin.dll (where the star represents the name you choose).
  2. Add your new custom builder class.
  3. The class must implement the ThoughtWorks.CruiseControl.Core.ITask interface (found in the ThoughtWorks.CruiseControl.Core.dll assembly).
  4. Mark your class with the NetReflector ReflectorType attribute. The name argument supplied to the attribute is the name of the element/attribute that will appear in the configuration file.
  5. Add any configuration properties that you need, marking them with the NetReflector ReflectorProperty attributes accordingly. Note that the attribute names are case sensitive and must match exactly in the configuration.
  6. Implement the Run method. The supplied IIntegrationResult should provide you with everything that you need to know about the current build.
  7. Compile the assembly.
  8. Copy the assembly into the folder containing the CruiseControl.NET assemblies (or the current directory that you are running the ccnet server from).
    ccnet.exe.config and ccservice.exe.config have a setting : PluginLocation which allows you to specify a specific folder containing plugins.
  9. Modify your ccnet.config file in accordance with the sample config file below.

Sample Builder Class

 1using System;
 2using Exortech.NetReflector;
 3using ThoughtWorks.CruiseControl.Core;
 4
 5namespace ThoughtWorks.CruiseControl.Sample.Builder
 6{
 7    [ReflectorType("mybuilder")]
 8    public class NAntBuilder : ITask
 9    {
10        public void Run(IIntegrationResult result)
11        {
12            Console.WriteLine("Hello World!");
13        }
14    }
15}

Sample Config File

 1<cruisecontrol>
 2    <project name="myproject">
 3        <tasks>
 4            <mybuilder>
 5                <!-- include custom builder properties here -->
 6            </mybuilder>
 7        </tasks>
 8    </project>
 9</cruisecontrol>

Detailed examples :

For a more detailed explanation visit this [blog|http://rubenwillems.blogspot.be/search/label/customizing%20code]
Section Customizing Code has multiple posts on how CCNet codes plays along.

Some direct links :