How does Sitecore Update Package Work – Creating Update Package
Posted 10/30/2016 by Subramanian Ramanathan
We have created Item, Version & Field Commands in our previous blogs.
Let’s see how to create an update package in this blog,
We have to create DiffInfo using the created commands. To know more about creating commands, have a look at previous blogs,
How does Sitecore Update Package Work - Introduction
How does Sitecore Update Package Work - Creating Item Commands
How does Sitecore Update Package Work - Creating Version Commands
How does Sitecore Update Package Work - Creating Field Commands
How does Sitecore Update Package Work - Creating Property Commands
How does Sitecore Update Package Work - Creating File Commands
We will have to specify Title, Author, Publisher, Read Me and Version for DiffInfo class.
DiffInfo diffInfo = new DiffInfo(commands);
diffInfo.Title = "Package Name";
diffInfo.Author = "Author Name";
diffInfo.Readme = "Read Me Text";
diffInfo.Version = "v1.0";
diffInfo.Publisher = "Publisher Name";
Similar to Sitecore ZIP Package, we do have Post Step for Sitecore Update Package too.
Syntax for PostStep will be,
diffInfo.PostStep = "YourNamespace.YourClassName, AssemblyName"
For Post Step, we will have to create a class and implement IPostStep.
We will have to create a Run Method with the below signature.
This code will be executed once all the files and items in the update package is installed.
In case if we need to do some changes to the existing items or files after update package installation, we may use this.
public class YourClassName : IPostStep
public void Run(Sitecore.Install.Framework.ITaskOutput output, System.Collections.Specialized.NameValueCollection metaData)
//Your code goes here..
We need to make sure that the specified PostStep class(dll) exists or will be installed along with update package.
Collision Behavior can be Force(default) or Skip.
If Collision Behavior is not set or is set to Force, then the existing items will be overwritten if there is a collision and the Action would be 'Overwrite Existing'. If Collision Behaviour is set to Skip, then the existing items will not be updated if there is a collision and the Action would be 'Keep Existing'.
Creating an update package is quicker and simpler than Sitecore ZIP Package. Update Package installation is not as expensive as ZIP Package installation, because we are not moving the entire item with all language versions, instead we will move only the changes.
Hope this helps.