Developer wearing headphones

Kentico sneaky feature: diff your CI XML files with Git

Kentico’s Continuous Integration module is extremely powerful and makes development teams’ lives much easier. But the popular version control system Git presents some issues we need to work around.

Picture of Luminary CTO Andy smiling with a black background

By Andy Thompson, 7 March 20172 minute read


November 2015: Kentico released its Continuous Integration (CI) module with Kentico 9, to wild cheering and screaming of developers around the globe. Dev teams were now able to work on their own local databases, serialise all of their database objects (such as templates, transformations, forms, even pages) as XML files in a CIRepository folder in the file system, which allowed them to use source control to track database changes... for some objects.

November 2016: Kentico’s platform team, led by the fearless Michal “King” Kadak, expanded the CI module in K10 to support practically all objects, even your own custom modules, with advanced filtering rules. Continuous Integration Nirvana reached!

Or was it? Do you use Git?

The Problem

.NET serialises objects (saves a representation of them as flat text files) using UTF-16 encoding - a text format which allows you to use all sorts of fancy characters, not just the standard ASCII set.

Git only supports UTF-8 encoding for text files. Other encoding, such as UTF-16, results in the files being recognised as generic binary files (such as ZIP or EXE files), so it can’t compare the contents line by line and tell you what’s changed (or “diff” them).

This means it can be very difficult to manage merge conflicts in Git when developing in teams, which is unfortunately one of the main benefits of using the CI module.

TL;DR: By default, Git doesn’t like the XML files the Kentico CI module produces.

The result:

  • Git can't see what has changed in a CI file:
Screenshot of git diffs of binary files
  • Developers are sad.
Sad Andy


It’s important to note that this isn’t a bug - it’s a limitation of Git, which just happens to be a very popular version control system used by developers.

Other version control systems or plugins can handle those UTF-16 files fine, but like so many other cool and trendy dev teams, we use Git.

It’s possible to diff files using third-party software on your local machine, such as KDiff3, but the most popular cloud-based git repository hosting services - such as Github, Gitlab, and Bitbucket Cloud - don’t give you that option.

(Hot tip from fellow MVP Kristian Bortnik - the locally hosted version of BitBucket does give you the option of converting text files to UTF-8 so they can be diffed, so if that’s what you’re using, you’re in luck!)

The Solution

As of Kentico Hotfix 10.0.11, you are able to change the encoding used by the CI module to UTF-8!

Once you've applied the hotfix (available for download here):

  1. Add the web.config key 
<add key="CMSCIEncoding" value="utf-8" />
  1. Reserialize your objects
Serialize all objects
  1. Commit it and push it
  1. Profit

It really is that easy. Just add a web.config key.

The result:

  1. Pull requests inside BitBucket now showing detailed diffs on XML files
Xml Diff
  1. Developers are happy!
Happy Andy

Thanks to the Kentico team as always, for listening to the dev community! It’s great to know that they prioritise the developers’ experience, and it’s also a great example of how beneficial the weekly hotfixes can be from Kentico.

Want to know more?

We have a whole team of experts who would love to talk to you.

Get in touch

Keep Reading

Want more? Here are some other blog posts you might be interested in.