Wednesday, November 13, 2024

Sitecore Upgrade 10.1 to 10.4 - Part-3

Hi All, 

Solution and Sitecore Updates

Assembly and Code Changes

Castle.Core Downgrade:

Web.config File Update:

  • Action: Add the following entries to include binding redirects:

HTML, XML

<dependentAssembly>

  <assemblyIdentity name="Castle.Windsor" publicKeyToken="407dd0808d44fbdc" culture="neutral" />

  <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />

</dependentAssembly>

 

<dependentAssembly>

  <assemblyIdentity name="Castle.Core" publicKeyToken="407DD0808D44FBDC" culture="neutral" />

  <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />

</dependentAssembly>

Layer.config Order Adjustment:

  • Reason: The previous sequence caused issues in our project.
  • Action: Updated the order to match the configuration of the existing Sitecore 10.4 website.

Code Reference Updates

File Path

Line Number

Old Code

New Code

D:\Projects\SampleProject\src\Foundation\Pipelines\code\Pipelines\Robots.cs

9

using Sitecore.XA.Feature.SiteMetadata.Enums;

using Sitecore.XA.Foundation.SiteMetadata.Enums;

D:\Projects\SampleProject\src\Foundation\Pipelines\code\Pipelines\Robots.cs

83

.Fields[Sitecore.XA.Feature.SiteMetadata.Templates._RobotsContent.Fields.RobotsContent]?

.Fields[Sitecore.XA.Foundation.SiteMetadata.Templates._RobotsContent.Fields.RobotsContent]?

D:\Projects\SampleProject\src\Foundation\Pipelines\code\Pipelines\Robots.cs

92

if (settingsItem != null && settingsItem.Fields[Sitecore.XA.Feature.SiteMetadata.Templates.Sitemap._SitemapSettings.Fields.SitemapMode]

if (settingsItem != null && settingsItem.Fields[Sitecore.XA.Foundation.SiteMetadata.Templates.Sitemap._SitemapSettings.Fields.SitemapMode]

D:\Projects\SampleProject\src\Foundation\Pipelines\code\Pipelines\RobotsforNonProd.cs

9

using Sitecore.XA.Feature.SiteMetadata.Enums;

using Sitecore.XA.Foundation.SiteMetadata.Enums;

D:\Projects\SampleProject\src\Foundation\Pipelines\code\Pipelines\RobotsforNonProd.cs

84

.Fields[Sitecore.XA.Feature.SiteMetadata.Templates._RobotsContent.Fields.RobotsContent]?

.Fields[Sitecore.XA.Foundation.SiteMetadata.Templates._RobotsContent.Fields.RobotsContent]?

D:\Projects\SampleProject\src\Foundation\Pipelines\code\Pipelines\RobotsforNonProd.cs

101

if (settingsItem != null && settingsItem.Fields[Sitecore.XA.Feature.SiteMetadata.Templates.Sitemap._SitemapSettings.Fields.SitemapMode]

if (settingsItem != null && settingsItem.Fields[Sitecore.XA.Foundation.SiteMetadata.Templates.Sitemap._SitemapSettings.Fields.SitemapMode]

D:\Projects\SampleProject\src\Foundation\Pipelines\code\Pipelines\SitemapXmlChangeSchemeToHttps.cs

7

using Sitecore.XA.Feature.SiteMetadata.Enums;

using Sitecore.XA.Foundation.SiteMetadata.Enums;

D:\Projects\SampleProject\src\Foundation\Pipelines\code\Pipelines\SitemapXmlChangeSchemeToHttps.cs

8

using Sitecore.XA.Feature.SiteMetadata.Sitemap;

using Sitecore.XA.Foundation.SiteMetadata.Sitemap;

D:\Projects\SampleProject\src\Foundation\Pipelines\code\Pipelines\SitemapXmlChangeSchemeToHttps.cs

48

SitemapChangeFrequency sitemapChangeFrequency = obj1.Fields[Sitecore.XA.Feature.SiteMetadata.Templates.Sitemap._Sitemap.Fields.ChangeFrequency].ToEnum<SitemapChangeFrequency>();

SitemapChangeFrequency sitemapChangeFrequency = obj1.Fields[Sitecore.XA.Foundation.SiteMetadata.Templates.Sitemap._Sitemap.Fields.ChangeFrequency].ToEnum<SitemapChangeFrequency>();

D:\Projects\SampleProject\src\Foundation\Pipelines\code\Pipelines\SitemapXmlChangeSchemeToHttps.cs

85

var target = ((ReferenceField)item.Fields[Sitecore.XA.Feature.SiteMetadata.Templates.Sitemap._Sitemap.Fields.Priority]);

var target = ((ReferenceField)item.Fields[Sitecore.XA.Foundation.SiteMetadata.Templates.Sitemap._Sitemap.Fields.Priority]);

D:\Projects\SampleProject\src\Foundation\Pipelines\code\Pipelines\SitemapXmlChangeSchemeToHttps.cs

98

return string.IsNullOrEmpty(item.Fields[Sitecore.XA.Feature.SiteMetadata.Templates.Sitemap._Sitemap.Fields.Priority]?.Value);

return string.IsNullOrEmpty(item.Fields[Sitecore.XA.Foundation.SiteMetadata.Templates.Sitemap._Sitemap.Fields.Priority]?.Value);

This table provides a clear overview of the changes made to the references in the specified files.

 

Issue and Resolution

CS1705 Error:

  • Description: Assembly 'Sitecore.Kernel' uses 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=7.0.0.0', which is higher than the referenced assembly version 3.1.5.0.
  • Cause: Sitecore.Analytics update required 'Microsoft.Extensions.DependencyInjection.Abstractions' version 6.0.0, while Sitecore.Kernel expects version 7.0.
  • Resolution: Updated 'Microsoft.Extensions.DependencyInjection.Abstractions' to version 7.0.

Web.Config.xdt Entry Issue:

  • Problematic Entry:

HTML, XML

<add type="Sitecore.Analytics.Media.MediaRequestSessionModule, Sitecore.Analytics" name="MediaRequestSessionModule"/>

Build Error:

  • Description: A missing RestSharp reference due to a version mismatch in the package config and the csproj file.
  • Resolution: Ensure the RestSharp reference is correctly aligned in both the package config and the csproj file.

I hope you enjoy this Sitecore blog. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)

Please leave your comments or share this article if it’s useful for you.

No comments:

Post a Comment