Could not resolve type name: Glass.Mapper.Sc.Pipel

2019-06-25 12:47发布

问题:

I am trying to use Glass Mapper in my MVC - v4.0.30319 project in Sitecore - 7.1.

Following are my Glass Mapper version which I have installed

  • Glass Mapper version - 3.0.10.23
  • Glass.Mapper.Sc version - 3.2.0.39
  • Glass.Mapper.Sc.Mvc version - 3.2.0.34

when I installed Glass mapper Mvc from nuget it added a config file called (Glass.Mapper.Sc.Mvc) in App_Config -> include folder

Content of the file is as follows

<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>

Now when I run my website, it gives me below error (when running the pipeline mentioned in the above config)

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))

but the reference is already there?

Am I missing any steps? Could someone please help.

回答1:

The developer of Glass Mapper has recently moved some classes to a separate MVC assembly and did not change the config file. The class which could not be loaded is now in the Glass.Mapper.Sc.Mvc assembly, so your config should look like this:

<mvc.getModel>
    <processor type="Glass.Mapper.Sc.Pipelines.Response.GetModel, Glass.Mapper.Sc.Mvc"/>
</mvc.getModel>