Patch delete Sitecore elements based on element content

Recently, I wrote about patching Sitecore instances for specific roles. During my research on how to do this, I was able to use a manner of Sitecore patching I had not previously known about. With a patch:instead, instead of targeting an attribute of the element you can actually target the contents of that element. (Thanks to @jammykam for that Stack Overflow post!)

Why is this useful?

Typically patch:instead is used to replace one value with another in the settings, but because of the matching capabilities of this syntax you can use this to patch:delete elements you couldn’t otherwise match against.

So, when you need to remove an element from the configurations that have multiple elements with no distinguishing characteristics, you can target the inner content instead to distinguish them.

Yummy Config example!

Below is a sample config file which can remove a <using> tag by targeting the text inside the using tag.

<?xml version="1.0"?>
<configuration xmlns:patch="" xmlns:set="">
        <!--Target based on text in the tag-->
        <using patch:instead="using[.='Sitecore.Social.Client.Wizards.AddNetworkAccount']">
          <patch:delete />

Sitecore DevOps: Deploying instance role configurations with solution

Those of you who have installed Sitecore in a scaled environment (i.e. multiple instances) know that the process can be somewhat tedious. To configure an instance to use a specific role, you need to manually enable/disable/modify config files to make the instance act as a delivery, authoring, or processing instance. Oh, do you also want to upgrade to the latest update? Be prepared to have to do it all over again.

While we wait for Sitecore to make this process a little bit easier, I decided that enough was enough and I wasn’t doing those steps anymore. Introducing the Sitecore Role Configs!

Inspired by the work in @kamsar’s SwitchMasterToWeb, the role configs capture the manual steps from those guides in a single role-specific file. Need to configure a processing instance? Drop the processing config file for your version of Sitecore.

Note: Hardening is not covered in these files, so keep that SwitchMasterToWeb handy!

At the time of writing, I’ve got Sitecore 8.0 Update 3 to Update 7 supported and will be working to get other versions in there as time goes by.

One day, I hope that the need for these files will be completely obsolete and I will laugh at how easy it is to deploy new roles of Sitecore. For now, though, happy deployments, and let me know if you find any issues and I’ll fix them up!