Tuesday, 24 June 2014

Error: Could not resolve type name Glass.Mapper.Sc.Pipelines.Response. GetModel, Glass.Mapper

4 comments
Today I was trying to use Sitecore Glass Mapping framework for my Sitecore MVC project. I’ve installed Glass Mapper from nuget and configured it for Sitecore MVC project. For more information on the Glass.Sitecore.Mapper visit the official website. Below are the few details about my development environment:
  • MVC Version:  4
  • Sitecore Version:  7.0
  • Glass.Mapper version:  3.0.10.23
  • Glass.Mapper.Sc version:  3.2.0.39
  • Glass.Mapper.Sc.Mvc version:  3.2.0.35
  • Glass.Mapper.Sc.Razor version:  3.0.9.13
Below config files will be added into App_Config\Includes folder once you install Glass Mapper framework:
  • Glass.Mapper.Sc.Razor.config
  • Glass.Mapper.Sc.Mvc.config
I got below error while browsing Sitecore MVC website.
Could not resolve type name: Glass.Mapper.Sc.Pipelines.Response.GetModel, Glass.Mapper.Sc (method: Sitecore.Configuration.Factory.CreateType(XmlNode configNode, String[] parameters, Boolean assert)).
While troubleshooting; I’ve checked Glass.Mapper.Sc.Mvc.config file.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
      <settings></settings>
    <pipelines>
      <mvc.getModel>
        <processor type="Glass.Mapper.Sc.Pipelines.Response.GetModel, Glass.Mapper.Sc"/>
      </mvc.getModel>
    </pipelines>
  </sitecore>
</configuration>
I’ve checked Glass Mapper official website and got to know that few classes have been move to separate MVC assembly and somehow changes were not getting reflected into .config file. Class Glass.Mapper.Sc.Pipelines.Response.GetModel has been moved to Glass.Mapper.Sc.Mvc assembly which was earlier in Glass.Mapper.Sc assembly. I’d modified Glass.Mapper.Sc.Mvc.config as below:
<sitecore>
      <settings></settings>
    <pipelines>
      <mvc.getModel>
        <processor type="Glass.Mapper.Sc.Pipelines.Response.GetModel, Glass.Mapper.Sc.Mvc"/>
      </mvc.getModel>
    </pipelines>
  </sitecore>
</configuration>
I rebuild the solution and I was no longer getting the error.  
Download correct Glass.Mapper.Sc.Mvc nuget package for your Sitecore MVC project.
Glass.Mapper.Sc.Mvc nuget package.

Sitecore VersionMVC VersionGlass.Mapper.Sc.Mvc nuget package
Sitecore 6.xMVC 3Glass.Mapper.Sc.Mvc-3
Sitecore 7.0-7.1MVC 4Glass.Mapper.Sc.Mvc-4
Sitecore 7.2MVC 35Glass.Mapper.Sc.Mvc-5
Comments and suggestions are most welcome. Happy coding! 

4 comments :

  1. Michael Edwards24 June 2014 at 21:14

    Hi
    Thanks for blogging this bug. This should be fixed if you are installing into a new project but it is a problem if you are upgrading an existing project.

    Mike

    ReplyDelete
  2. Great. Thanks Mike. :)

    ReplyDelete
  3. ASP.NET training in Jaipur provides quality training with live projects. Learn on web designing and development with error solving tricks.

    ReplyDelete
  4. Nice blog on bug. Training give you way to learn and resolve error solving technique.
    Live project training in Jaipur

    ReplyDelete