Thursday, December 09, 2010

Assembly Version Conflicts for Newtonsoft.Json, Telerik, ComponentArt, etc.


Hi there,

Most of you know that Sitecore CMS relies on a few 3rd party components that help providing compelling web experience. A few come to mind: Telerik’s RTE, ComponentArt’s grids, JSON for .NET utility from Newtonsoft, Lucene.NET, etc.

Since earlier Sitecore versions (pre 6.3) rely on older versions of these 3rd party assemblies and most implementers are logically striving for using latest and greatest, conflicts of assembly versions arise. And strangely enough, I am hearing about these issues quite frequently now.

So how can these conflicts can be resolved?

Well, since an option of registering those in GAC is almost always a big NO-NO, the following technique proved to be workable for a few customers. It is called assembly version redirection.

What you need to do is add the following into the web.config’s <assemblyBinding>. The following example covers the “Newtonsoft.Json” assembly, however this is applicable to any other 3rd party assembly:

<dependentAssembly>
   <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
   <codeBase version="3.5.0.0" href="C:\wwwroot\Sitecore\WebSite\new_bin\Newtonsoft.Json.dll"/>
</dependentAssembly>

Afterwards, feel free to reference the newer version in your Visual Studio project, just remember to set the “Copy Local” property to False.

Note that since the release of Sitecore 6.3, most of those 3rd party assemblies were updated, so this article may be completely useless to you. Just make sure to check the exact Sitecore version you are using on the login page!

As always, thanks goes to our tech support for finding such a plausible alternative.

4 comments:

Mark Ursino said...

I actually got this to work once but after my app pool was recycled it never worked again. I'll have to try it again as we like to use Telerik's 2010 controls.

RaiGunn said...

Hi Alex, couple questions.

In this example, do you have all of your dlls in \new_bin\ or just the Newtonsoft.Jason.dll?

And in your Visual Studio project do you reference both versions of the Newtonsoft.Jason.dll or just the newest version?

Thanks!

metrognome said...

We've gotten this to work with version 2010.3.1109.40 of the RadControls, but when we go to use the RadEditor, the CSS seems to be completely lost. Do you have any experience with this?

Cory Robinson said...

Alex, is there a way to use later versions of the Telerik ASP.NET AJAX DLLs while using Sitecore 6.4.1 rev.110720 (Update-3)? I have tried the method above and have not been able to get it to work. It seems like there are places within the Sitecore code that don't specify a version (of Telerik.Web.UI), so I am concerned that forcing it to use a newer version (via "bindingRedirect") may be problematic.