December 2009 - Posts

CruiseControl.NET Configuration Reference

For some reason it is very difficult for me to find the CruiseControl.NET configuration reference online.  Most of the time I end up on an older reference which is out of date and just not correct. 

This is the CruiseControl.NET reference that appears to be up-to-date:

CruiseControl.NET Configuration Reference

On the bottom of each page is a list of the children for each configuration block and at the top is the breadcrumb for how far you have drilled down into the tree.



And then you can view the full CruiseControl.NET configuration hierarchy here.

This blog post is mostly for me but also, if I am having a tough time finding the reference then I imagine a lot of other people are too.

Prevent CruiseControl.NET error “Source control operation failed: Working copy locked svn”

My CruiseControl.NET build system was running into an error whenever two projects were trying to build at the same time.  Both of these projects try to go out to our subversion source control repository and one will win and the other gets locked out.

The build will then fail with this type of error:

ThoughtWorks.CruiseControl.Core.CruiseControlException: Source control operation failed: svn: Working copy 'XXXX' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) .

To get around this issue you can use the “queue” attribute of the project node:


Here is the Thoughtworks CruiseControl.NET Project configuration reference section:

Originally I did not set a queue value for each project that is built.  The default in this instance is the project name, so each project ends up in its own queue and therefore they will build as soon as possible and cause the locking error.

From the Thoughtworks reference:

The name of the integration queue that this project will use. By default, each project runs in its own queue. (Added in CCNet 1.3) 

So by setting the queue for each of the projects to the same value (since all of the projects are related), each of them will wait and build one at a time, resolving the “Source control operation failed: svn: Working copy 'XXXX' locked svn” error.

Note: You can also set the queuePriority to indicate the order the project should build when it is in the queue.

This StackOverflow post lead me to this solution: How can I prevent concurrent builds in CruiseControl.NET?

Handle the button click event from an ASP.NET ListView control

Here is how you can handle the event of a button from within an ASP.NET ListView control.

Add your button to the ListView Template like you would any other control:

<asp:ListView ItemPlaceholderID="Test" runat="server" ID="ListView1" >
        <asp:Button runat="server" Text='<%# Eval("MyProperty") %>' CommandArgument='<%# Eval("MyProperty") %>' /><br />


And then handle the ListView.ItemCommand event in your code:


That is really all there is to it.  The ListView will bubble up the Button’s click event to the ListView_ItemCommand event handler and then you can handle it there.  You can also use the CommandArgument property to send button specific data, such as the particular ID of the row or item that the user clicked the button for.

This call also be used on some of the other databound controls such as the ASP.NET Repeater.


Full Example Code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ListViewButtonExample.aspx.cs" Inherits="ListViewButtonExample" %>
    <form id="form1" runat="server">
        <asp:ListView ItemPlaceholderID="Test" runat="server" ID="ListView1" >
                <asp:Literal runat="server" ID="Test"></asp:Literal>
                <asp:Literal runat="server" Text='<%# Eval("MyProperty") %>'></asp:Literal>
                <asp:Button runat="server" Text='<%# Eval("MyProperty") %>' CommandArgument='<%# Eval("MyProperty") %>' /><br />
        <asp:Literal runat="server" ID="Literal1"></asp:Literal>

using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.Collections;

public class MyObject
    public String MyProperty { get; set; }
public partial class ListViewButtonExample : System.Web.UI.Page
    protected void Page_Init(object sender, EventArgs e)
        ListView1.ItemCommand += new EventHandler<ListViewCommandEventArgs>(ListView1_ItemCommand);

    void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
        Literal1.Text = "You clicked the " + (String)e.CommandArgument + " button";

    protected void Page_Load(object sender, EventArgs e)
        if (!Page.IsPostBack)
            List<MyObject> col = new List<MyObject>();
            col.Add(new MyObject { MyProperty = "test 1" });
            col.Add(new MyObject { MyProperty = "test 2" });
            ListView1.DataSource = col;


Technorati Tags: ,

IIS7 Search Engine Optimization Toolkit does not like HTML5 Doctype

The IIS7 Search Engine Optimization (SEO) Toolkit is an awesome tool to review your site and indicate any problems with the html that may cause search engines not to index your website properly.  Check out Scott Guthrie’s post on the IIS7 Search Engine Optimization Toolkit or you can download it from the IIS website at the tool’s home: IIS7 SEO Toolkit.

But I ran into an issue with the tool the other day where it was not returning the proper results.  I ran it against a website I was working on and it only crawled one page and returned results that were just not correct:


The errors: “The title is missing.”, “The description is missing.”, and “The <h1> tag is missing.” were incorrect since I had all of those on the home page of the site I was testing, but also it was curious that it was not crawling any other urls off of that home page.

AND the content tab even showed all of these things in the html that the tool had retrieved:


Eventually I was able to track it down to using the HTML5 Doctype tag:

<!DOCTYPE html>

The HTML5 document type is not official yet but I have gone ahead and started using as recommended by many developers but apparently the IIS7 SEO Toolkit does not like this doctype yet.  Temporarily I switched it to another doctype:


And the SEO Toolkit worked as expected.  Just a heads up for any other developers that run into this when using HTML5 DOCTYPE.

UPDATE (2009-12-07):

Dave Cox added a comment about it not being the HTML5 DOCTYPE per say but the whitespace that comes before it.  Having a line of whitespace AND the HTML5 DOCTYPE causes the IIS7 SEO Toolkit not to read the content correctly.



I am using ASP.NET MVC in this project so that means my master page will look like this; the DOCTYPE declaration on the same line as the Master page directive:


More Posts « Previous page



This Blog