Some people find it a bit tricky to write Sitecore config files. It can sometimes be a bit tricky or time consuming to get the element structure correct. Ever found yourself debugging an issue where it turned out the config file wasn’t applied properly due to an element structure mistake?
The XPath Tools plugin, by Uli Weltersbach, for Visual Studio is a great help for creating those config patch files. Here’s a way to create those in a fast and simple way:
Start with a Sitecore config boiler plate:
Then grab the expanded Sitecore config file through Sitecore Rocks:
Navigate to the section where you want to apply your config change and select “Copy XML structure”. In this example I’ll add a computed field to the default Solr index section:
Then paste it into your config template:
From here on it’s a simple task to just remove the surplus attributes you don’t need, such as database="SQLServer" xmlns:patch
… and so on:
So XPath tool is a small but very helpful tool that makes life just a little bit easier.
You can get the XPath tool from within Visual Studio or download it here, or grab it from GitHub.
Pingback: A tool to help you build config patches | Jeremy Davis