Welcome to EMC Consulting Blogs Sign in | Join | Help

Russell Seymour's Blog

CruiseControl Build Notification with Messenger

For those of you that know CruiseControl.NET will know that you can get updates of how the continuous builds are progressing using CCTray.  However this can be limiting if you are a develper in the team and are not on the same network as the development server, thus you may not get the information you need.

This is where the Messenger comes in.  Using some ideas and libraries that have been created for such a purpose from here, it becomes a relatively easy thing to sort out.

NB. The site describes a setup with VS 2005 and Source Safe, the following guidelines are for Subversion and is not bound to any IDE.

Download the zip file from the website and unpack the DotMSN.dll and Macaw.MSBuild.Tasks.dll to any directory.  These two libraries now need to be added to the GAC (Global Assembly Catalog):

gacutil -i DotMSN.dll
gacutil -i Macaw.MSBuild.Tasks.dll

Now these have been added to the system, modify the ContinuousIntegration.proj file (or whatever file your CruiseControl uses) and add the following lines:

<UsingTask TaskName="Macaw.MSBuild.Tasks.CheckWorkspaceUpToDate" AssemblyName="Macaw.MSBuild.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=77d1de835a1afaee" />
<UsingTask TaskName="Macaw.MSBuild.Tasks.StartTeamBuild" AssemblyName="Macaw.MSBuild.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=77d1de835a1afaee" />
<UsingTask TaskName="Macaw.MSBuild.Tasks.GetUnexaminedBuild" AssemblyName="Macaw.MSBuild.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=77d1de835a1afaee" />
<UsingTask TaskName="Macaw.MSBuild.Tasks.MessengerNotification" AssemblyName="Macaw.MSBuild.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=77d1de835a1afaee" />

Now that the assemblies have been added the appropriate Targets must be added.  The following is an example of a target that could be used:

  <Target Name="Notify">
     <SvnInfo LocalPath="$(SourceDirectory)">
         <Output TaskParameter="LastChangedAuthor" PropertyName="LastChangedAuthor" />
     </SvnInfo>

     <CreateProperty Value="$(LastChangedAuthor) prompted the latest SVN Checkout by CruiseControl">
     <Output TaskParameter="Value" PropertyName="Shamer" />
     </CreateProperty>

     <CreateProperty value="CruiseControl MSBuild Script has been called, no status available">
         <Output TaskParameter="Value" PropertyName="MSNMsg" />
     </CreateProperty>

     <!-- Message for successful build of project -->
     <CreateProperty
    Condition="'$(CCNetIntegrationStatus)'=='Success'"
        Value="$(Shamer) \n (Y) Project has successful built">
        <Output TaskParameter='Value' PropertyName="MSNMsg" />
     </CreateProperty>

    <MessengerNotification Message="$(MSNMsg)"
        SenderAlias="Conchango Continuous Integration Notification"
        SenderAccount="example@conchango.com"
        SenderPassword="xxxxxxx"
    Recipients="someone.to.be.notified@conchango.com"
    />
  </Target>

Finally a Messenger account must be created so that the system has an account to send from.  In addition this account must have the recipients in their contact list that you would ever want to notify.

  1. Create a new account on the MSN Site or use Windows Live Messenger.
  2. Sign into this account on your machine and add the recipients to the list, you will have to wait until people authorise the account before it can be used to send notification messages.
  3. Now use the account information in the target you have created in the MSBuild Script.
If all has gone to plan anyone in the recipient list should be able to see the status of the builds.

Troubleshooting:

If the development servers are on a slow network you may find that MSBuild timesout waiting for a response to send the message to the recipient.  At the moment I do not know a cure for this.


Published 21 August 2006 15:12 by Russell.Seymour

Comments

 

howard.vanrooijen said:

Wicked - that's a nice upgrade to James Simmonds old SendMSN utility! http://blogs.conchango.com/jamessimmonds/archive/2004/11/24/322.aspx
August 22, 2006 23:10
 

John Rayner's Blog said:

Here I present a Windows Service which signs in to an MSN Messenger account at startup and exposes some web services in order to send messages. A custom MSBuild task is also included which consumes these web services.

November 1, 2006 14:23
 

John Rayner's Blog said:

Here I present a Windows Service which signs in to an MSN Messenger account at startup and exposes some web services in order to send messages. A custom MSBuild task is also included which consumes these web services.

March 16, 2010 01:12
Anonymous comments are disabled
Powered by Community Server (Personal Edition), by Telligent Systems