Wednesday, June 22, 2016

Glass Mapper error with web forms project

I added the Glass Mapper package to a Sitecore project which was web forms based and the following error was appearing when attempting to load the Sitecore admin area.
Could not resolve type name: Glass.Mapper.Sc.Pipelines.Response.GetModelFromView, Glass.Mapper.Sc.Mvc (method:
Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)).
Looking into the details, Glass Mapper added a config file to my solution: Glass.Mapper.Sc.config. This file then referenced the MVC specific DLL: Glass.Mapper.Sc.Mvc in the pipelines. The fix was to remove the following section from the config file:

<mvc.getModel>
  <processor patch:before="*[@type='Sitecore.Mvc.Pipelines.Response.GetModel.GetFromItem, Sitecore.Mvc']"  type="Glass.Mapper.Sc.Pipelines.Response.GetModel, Glass.Mapper.Sc.Mvc"/>
  <processor patch:before="*[@type='Sitecore.Mvc.Pipelines.Response.GetModel.GetFromItem, Sitecore.Mvc']"  type="Glass.Mapper.Sc.Pipelines.Response.GetModelFromView, Glass.Mapper.Sc.Mvc"/>
</mvc.getModel>

It is a known issue.

1 comment: