I would like to use Autofac in my Sitecore project with Solr, I have set next code to global.asax
<%@Application Language='C#' Inherits="Sitecore.ContentSearch.SolrProvider.AutoFacIntegration.AutoFacApplication" %>
but i see an error
Method not found: 'Void Autofac.RegistrationExtensions.RegisterModule(Autofac.ContainerBuilder, Autofac.Core.IModule)'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.MissingMethodException: Method not found: 'Void Autofac.RegistrationExtensions.RegisterModule(Autofac.ContainerBuilder, Autofac.Core.IModule)'
I have checked AutoFac version and it is correct 3.5.2 like in Sitecore.ContentSearch.SolrProvider.AutoFacIntegration
What should I do to set up it correct in term of Sitecore.
This issue happens because Sitecore's Solr support package relies on an old Autofac version (3.1.5 or earlier) where the method builder.RegisterModule()
was still defined in Autofac.RegistrationExtensions
. Newer Autofac versions have a similar method defined in the class Autofac.ModuleRegistrationExtensions
.
Without Sitecore recompiling the Solr/Autofac integration dlls, unfortunately, there are only two ways around this:
This issue is still present in the Solr support package shipped with Sitecore 8.2.
I have registered this issue with Sitecore Support.
Edit: Sitecore replied that the support of Autofac 3.2 and later is on the wish list. To track the status of this request, you can use the reference number 94626.