Corey Burnett
Corey Burnett

Reputation: 7340

How to use Glass Mapper 3.3 with Sitecore 7.x and Solr 4.7

Has anyone else had problems getting Sitecore 7.x and Solr 4.7 to work with Glass Mapper 3.3? It seems like Glass Mapper uses the Castle Windsor IOC container. And Sitecore recommends using the Castle Windsor IOC container for Solr also.

According to Sitecore, they are telling me that I should use Solr 4.7 and I should use version 3.1 of Castle.core.dll and Castle.Windsor.dll. However it looks like Glass Mapper 3.3 requires version 3.2+ of Castle.Core.dll.

I would think that I am not the only person that has had this problem. But I couldn't find anything on the web about it.

Upvotes: 3

Views: 320

Answers (1)

samy
samy

Reputation: 14962

To elaborate on Phil Degenhardt comment, you can use binding redirect configuration to have both references resolve to the same assembly. Basically you need to setup a range of versions that will point to the same assembly:

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="Castle.Windsor"
                              publicKeyToken="xxxxxxxxxxxxxxx"
                              culture="neutral" />
            <bindingRedirect oldVersion="3.1.0.0 - 3.1.9.0"
                             newVersion="3.2.0.0"/>
         </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>

You could also use probing to have both assemblies versions live side by side, by setting it up like that:

<dependentAssembly>
  <assemblyIdentity name="Castle.Windsor" publicKeyToken="xxxxxxxxxxxxx" /> 
     <codeBase version="3.1.0.0" href="v31/Castle.Windsor.dll"/>
     <codeBase version="3.2.0.0" href="v32/Castle.Windsor.dll"/>
</dependentAssembly>

This second option is useful if there are changes in the public part of the assembly, redirection may be more useful in your case.

Upvotes: 5

Related Questions