• Installing .NET Core SDK for Azure Pipelines builds

    How do you ensure that the correct version of .NET Core SDK is installed for your Azure Pipeline builds? You could install it manually on your build agents, but wouldn’t it be better to automate it?

    The .NET Core Tool Installer Task can be used for this, and if you don’t change the version of the SDK that you require frequently, very often that’s enough.

    When you’re developing .NET Core applications, you can indicate which version of the SDK you require to build with by using a global.json file.

    Unfortunately, the Installer Task doesn’t currently know about global.json, so you might feel like you’re doubling up - specifying the required version not only in that file but also in the configuration of the Installer Task. Don’t do that!

    With a bit of PowerShell, that can be done.. Create a PowerShell Task that runs before the Installer task and use it to set a variable that can then be used by the following task(s).

    If you’re using YAML, the task definitions would look something like this:

    - powershell: |
        $PathToGlobalJson = Join-Path -Path $Env:BUILD_SOURCESDIRECTORY -ChildPath "global.json"
        $GlobalJson = Get-Content -Raw -Path  $PathToGlobalJson | ConvertFrom-Json
        $Version= $GlobalJson.sdk.version
        Write-Host ("##vso[task.setvariable variable=SdkVersion;]$Version")
      displayName: 'Parse global.json'
    - task: DotNetCoreInstaller@0
      displayName: 'Use .NET Core sdk $(SdkVersion)'
        version: '$(SdkVersion)'

  • 2018 draws to a close..

    Stone stairway, with sunlight casting shadows

    2018 is almost done. It’s the day after Christmas, about 38°C outside (just over 100°F in the old money - not uncommon for this time of year in Adelaide). As I sit here under the cooling, gentle breeze from the air conditioner, I’ve compiled some of my 2018 highlights. (Let me know in the comments if I’ve missed something obvious)


    RL Solutions are/have merged with Datix. No changes yet, other than getting to meet a couple of people from the Datix side (including from their Melbourne office).

    Our Adelaide team also grew this year with some new hires. We do miss Tom (having lost him to Toronto), but we’ve managed to survive, and it was great to have him back for a week last month. A part from my coding and team lead responsibilities, Tom’s move has meant I’ve picked up additional roles of office grocery/supplies organiser and local IT support.

    One particular recent highlight was upgrading the office to a 1G fibre Internet connection, taking advantage of the 10G Adelaide initiative. That’s been a huge win - bandwidth is essentially no longer a constraint on getting things done.

    <a href=/assets/2018/12/20181219_223749070_ios.jpg imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="Tarts and fruit mince pies" border="0" data-original-height="756" data-original-width="1008" height="240" src=/assets/2018/12/2_20181219_223749070_ios.jpg title="Tarts and fruit mince pies" width="320"></a>
    Toronto sent a lovely Christmas present to the Adelaide office. Yum!

    User Group

    The Adelaide .NET User Group has finished on a positive note. We’ve had increased attendances the last few months which is really encouraging. We’ve also had a sponsor come on board, which means we can run meetings for free now that our pizza costs are covered.

    People seated, watching a presentation

    It would be great to have others join me in organising the group - it does concern me that I’m the ‘single point of failure’ at the moment.

    In addition to monthly meetings, I’m looking forward to some announcements in the new year about a bigger developer event for Adelaide.


    Managed to do some user group talks locally as well as while I was in Toronto, but the highlight for the year was being picked to present as part of .NET Conf.


    A bit less this year - two weeks in North America in March (Toronto for work and then Seattle/Redmond for the Microsoft MVP Summit). Coming down with a nauseous gastro-type bug for the last couple of days and the flight home was not a highlight. Definitely an incentive to remember good hand hygiene!

    We also had a family holiday interstate and flew (instead of driving all the way). More costly, but quicker and less stressful.


    A significant time of year, and one I really enjoy. I have many happy memories of Christmases as a child, and I hope we’re creating them for our kids now.

    Our family traditions include taking part in our Church’s Road to Christmas ‘Bethlehem re-enactment’, joining with friends to sing carols at a local hospital, attending a Christmas Eve church service, and then gathering with family for a meal on Christmas Day.

    Bonus tip: My aunty told me that she buys a platter/plate from a 2nd hand shop for the food that she brings. That way she doesn’t need to worry about having to remember to bring it home.


    We bought my son a turtle for his birthday the previous year. ‘Nibbles’ is now fast outgrowing his tank, so the current project is to build a pond out in the garden where he can live (the turtle, not my son!)

    The pond shell/liner, redgum wood sleepers, a pump and filter, shade-cloth all add up to be a surprising amount. Not to mention the manual labour of digging the hole in the ground!

    I think Nibbles will appreciate it when it’s all done.

    <a href=/assets/2018/12/20181202_041340767_ios.jpg imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="Person lowering a turtle into a pond" border="0" data-original-height="756" data-original-width="1008" height="240" src=/assets/2018/12/2_20181202_041340767_ios.jpg title="Person lowering a turtle into a pond" width="320"></a>
    Nibbles the turtle, about to give the pond a test drive/swim


    That’s the band I play in. We’ve had a few gigs this year, and might be doing some recording in 2019. I was sad when Jane (our violin/mandolin player) retired as that left me as the sole string player on ‘Cello. I’ve had to pick up some of Jane’s parts in some of our songs. Our last gig for the year was something a bit different (and special) - playing for Liz (who also sings in our band) as part of her service of ordination to become a Deacon.

    <a href=/assets/2018/12/20181006_083909559_ios.jpg imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="David at a band soundcheck" border="0" data-original-height="580" data-original-width="772" height="240" src=/assets/2018/12/2_20181006_083909559_ios.jpg title="David at a band soundcheck" width="320"></a>
    Sound check, with Pete and Keith photo-bombing

    When you’re young, you sometimes dream about being a rock-star. Well that hasn’t happened! But I do get to play instruments and sing on stage with good friends, and people seem to like our music, so while I’m not giving up my day job, it is a lot of fun.


    I try and get out for a ride when I can. Seemed to be less commute riding this year, but got out for a few Saturdays with the Mud, Sweat and Gears mob. Looking forward to the Tour Down Under in January and riding in the Challenge Tour with my Dad and my Son (3 generations of Gardiners) as well as brother-in-law James.

    Bicycle sitting next to a fence, overlooking green rolling hills


    I tend not to post much about my family here. If you know me personally then I might have shared a bit more about how we’re all going. Needless to say, the kids are growing up fast!

    Thanks for reading, see you in 2019 :-)


  • Top 10 source code files by line count

    What are the top 10 source code files (by number of lines)?

    gci -Recurse *.cs -ErrorAction SilentlyContinue | % { $file = $_; Get-Content $_ | Measure-Object -Line | Add-Member File $_ -PassThru } | Sort-Object -Descending -Property Lines | Select-Object -First 10 -Property File, Lines

    Note the use of Add-Member to capture the filename so we can display it in the output