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?
2 Answers
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=4.0.0.0, 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">
<assemblies>
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add assembly="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
Sitecore.Kernel
,Glass.Mapper
,Glass.Mapper.Sc
andGlass.Mapper.Sc.Mvc
references@using Glass.Mapper.Sc.Web.Mvc
at the begining of your View?The type 'Expression<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
(i have that reference)