• Installing CruiseControl.NET on Windows Server 2008

    We’ve been running CCNet on a very old workstation, and the build times were starting to get rather long. To fix this, we’ve had a new Windows Server 2008 virtual machine provisioned.

    These are roughly the steps I followed to get things up and running:

    1. Enabled IIS 7, WPAS and SMTP
    2. Installed .NET 3.5 SP1
    3. Installed CruiseControl.NET 1.4
    4. Updated web.config to allow webdashboard to run in integrated mode by adding the following section:

    <system.webServer>

    <handlers\>
    
        <add name\="\*.xml\_\*" path\="\*.xml" verb\="\*" type\="ThoughtWorks.CruiseControl.WebDashboard.MVC.ASPNET.HttpHandler,ThoughtWorks.CruiseControl.WebDashboard" preCondition\="integratedMode,runtimeVersionv2.0" />
    
        <add name\="\*.aspx\_\*" path\="\*.aspx" verb\="\*" type\="ThoughtWorks.CruiseControl.WebDashboard.MVC.ASPNET.HttpHandler,ThoughtWorks.CruiseControl.WebDashboard" preCondition\="integratedMode,runtimeVersionv2.0" />
    
    </handlers\>
    
    <security\>
    
    <requestFiltering allowDoubleEscaping\="true" />
    
    </security\>
    

    </system.webServer>

    1. Installed applications required for building and testing:
      • CollabNet SVN 1.5.1
      • TortoiseSVN 1.5.1
      • Gallio
      • FxCop 1.36
      • Sandcastle
      • Sandcastle Help File Builder
      • Windows SDK for Server 2008 (just dev tools)
      • Report Viewer 2008 SP1
      • SQL Server Express 2008
      • Change CCService to run as Automatic and as specific ‘build’ user.
      • Grant ‘Modify’ access to ‘build’ user to ‘C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files’.

    One issue I did find right at the end – one of our tests was failing with this unusual error:

    System.Windows.Markup.XamlParseException: ‘DockPanel’ object cannot be added to ‘Viewbox’. Exception has been thrown by the target of an invocation. Error at object ‘System.Windows.Controls.DockPanel’ in markup file ‘AbbGrain.Aom.Client;component/shell.xaml’. —> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.Runtime.InteropServices.COMException (0x80070018): The program issued a command but the command length is incorrect. (Exception from HRESULT: 0x80070018) at MS.Internal.HRESULT.Check(Int32 hr) at System.Windows.Media.MediaSystem.Startup(MediaContext mc) at System.Windows.Media.MediaContext..ctor(Dispatcher dispatcher) at System.Windows.Media.MediaContext.From(Dispatcher dispatcher) at System.Windows.Media.Visual.VerifyAPIReadWrite() at System.Windows.Media.Visual.VerifyAPIReadWrite(DependencyObject value) at System.Windows.Media.VisualCollection.VerifyAPIReadWrite(Visual other) at System.Windows.Media.VisualCollection.Add(Visual visual) at System.Windows.Controls.Viewbox.set_InternalChild(UIElement value) at System.Windows.Controls.Viewbox.set_Child(UIElement value)

    All the more strange, as the test was passing on the old build server and also passed on all our workstations. Turns out it’s a bug in .NET 3.5 SP1.

    There’s a comment at the bottom of the bug that changing the service to run in XP SP2 compatibility mode should work around the issue. This didn’t work for me initially, until I realised I needed to click on the ‘Show settings for all users’ and then set compatibility for all users. eg.

    Compatibility for all users dialog

    Restarting the service then saw the WPF test pass.

  • HasMany and null foreign key columns

    I’ve been trying to figure out why our data layer wasn’t saving a new item that we’d added to a [HasMany] collection.

    To figure out what was happening, I build a simple sample based on the examples from the Castle ActiveRecord documentation.

    ClassDiagram1

    This generates a database schema like this:

    BlogPostTableDiagram

    Normally you’d make the foreign key column ‘blogid’ not null, but (as mentioned in this thread) for NHibernate, it does an INSERT then an UPDATE so the foreign key column does need to be nullable.

    I can understand this might be the case if the Blog entity hadn’t been saved, but it is surprising that it doesn’t recognise that it could use a single INSERT statement if it does know the foreign key value.

  • NHibernate 2.0 GA

    Fabio announced that version 2.0 of NHibernate is now released. This is great timing, as we’ve been using the release candidate for a few weeks now.

    Download from SourceForge.

    Unfortunately this release doesn’t include LINQ for NHibernate, but the word on the street is that is planned for 2.1. That will be a really useful addition. I’d much prefer to use LINQ to write queries and let the compiler check the syntax rather than have HQL strings that I only find out at runtime are incorrect.