How to resolve “publishing HTML cache clearer” error while upgrading Sitecore?
Published: 23 March 2023

Through this blog, we will try to understand what the publishing HTML cache clearer error is and how you can resolve it while upgrading Sitecore.
During the process of upgrading Sitecore 9.2 to 10.2, you will find this error given below. When using Sitecore 9.2, the HTML cache clearer was used for multiple regions and multiple languages. But, it was creating issues when it came to Sitecore 10.2 So, let us resolve it using the below given steps.

Step 1 Go to your inetpub folder and go to the wwwroot folder.
Step 2 Go to your project folder and to the App_Congig folder.
Step 3 Go to the include folder and click on the project folder.
Step 4 Go to your website.config for an example: dev. website.config after removing the below code:
<events>
<event name="publish:end">
<handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
<sites hint="list">
<site hint="sitename">sitename</site>
</sites>
</handler>
</event>
<event name="publish:end:remote">
<handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
<sites hint="list">
<site hint="sitename">sitename</site>
</sites>
</handler>
</event>
</events>
Step 5) Add the line: preventHtmlCacheClear="true" in site config and save the config.
<site name="custom_website" cacheHtml="true" preventHtmlCacheClear="true" />
Step 6) Refresh the site.
The error will now be gone and the website will perfectly load after the given steps.

Mitesh Patel - Technical Head - ADDACT
Sitecore || XMCloud || OrderCloud Certified
Mitesh, a distinguished Technical Head at Addact/Addxp, is a prominent figure in Sitecore/XMCloud/OrderCloud certified writing. From Sitecore XM Cloud Developer Certification to Sitecore 10 .NET Developer Certification and Sitecore OrderCloud Certification, Mitesh's expertise is unparalleled. Mitesh is not only a skilled Sitecore CMS developer but also a 12+ years experienced software engineer proficient in various technologies such as MVC, ASP.Net, C#, jQuery, and Azure cloud/AWS.
