I've installed Glass.Mapper.Sc (v4.3.4.196) with out any problems but in a razor view i can't use helper @Html.Glass() because i have an error that says that HtmlHelper does not contain a definition for Glass and no extension method Glass... i'm missing something?

  • Do you have the Glass.Mapper references in your project? Before you install Glass.Mapper you need to reference the Sitecore.Kernel to make it work. Feb 2, 2017 at 14:05
  • 1
    Yes, i have Sitecore.Kernel, Glass.Mapper,Glass.Mapper.Sc and Glass.Mapper.Sc.Mvc references
    – Phoenix_uy
    Feb 2, 2017 at 14:06
  • Do you have the @using Glass.Mapper.Sc.Web.Mvc at the begining of your View? Feb 2, 2017 at 14:09
  • Adding that, i have the error The type 'Expression<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Core, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' (i have that reference)
    – Phoenix_uy
    Feb 2, 2017 at 14:10
  • 2
    Let us continue this discussion in chat. Feb 2, 2017 at 14:24

2 Answers 2


The problem was with MVC setup in the project not with Glass. This was the solution - http://samirvaidya.blogspot.hu/2015/10/the-type-expression-is-defined-in.html.

The error was exactly

The type 'Expression<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Core, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089

And non of the HtmlExtensions was not working. Solution is that you need the following references in your web.config.

<compilation debug="true" targetFramework="4.5">
        <add assembly="System.Core, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
        <add assembly="System.Data, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
        <add assembly="Microsoft.CSharp, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        <add assembly="System.Runtime, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />   
        <add assembly="System.Web.Abstractions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Helpers, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

I added

@using Glass.Mapper.Sc.Web.Mvc 

on Top and it solved my problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.