Incrementing the Umbraco Client Dependency version with Octopus Deploy

April 30, 2016

This is an old archived post, content maybe out of date, links may be broken and layout may be broken.

If you use Octopus deploy to deploy your Umbraco sites, you’ve probably forgotten to increment the Client Dependency version before building and deploying - which leads to old CSS and JavaScript being served.

Octopus Deploy allows you to run custom powershell scripts during the deployment life cycle - and the one below will set the client dependency version.

$Config = ".\config\ClientDependency.config";

If (Test-Path $Config) {

    $Cd = New-Object System.Xml.XmlDocument
$Cd.Load($Config)
    
$Rel = ($OctopusParameters['Octopus.Release.Number']);
    $Cd.clientDependency.version = $Rel.Replace(".", "");

    $Cd.Save($Config)
} 

If (Test-Path "bin\version.txt"){
Remove-Item "bin\version.txt"
}
"$($OctopusParameters['Octopus.Release.Number'])" | Out-File "bin\version.txt"

The script should be run post deployment. Rather than incrementing the client dependency version - it derives an integer from the octopus release version, so the client dependency version is distinct for each release.

If you need some help setting up Octopus deploy and Umbraco - get in touch with me, via my company website.

Comments

David Peck - April 26, 2017

I’m guessing you prefer to have this as a deployment step rather than a build one, but I recently posted this to do it with MSBuild. https://our.umbraco.org/forum/extending-umbraco-and-using-the-api/85268-howto-get-msbuild-to-update-the-client-dependency-framework

Simon Dingley - August 14, 2019

Thanks for sharing Darren - works a treat!

Leave a Comment

Comments are manually moderated and added once reviewed.

© 2021 Darren Ferguson, Built with Gatsby.