新足迹

 找回密码
 注册

精华好帖回顾

· 墨尔本的火车 (2005-10-5) goldenapple · 回忆在悉尼的点点滴滴 (2009-2-24) 大玉儿
· 来和七朵花一起记录玉米的生长过程,最新照片更新12月30日,收成拉(悲催了。。。。。。。。) (2011-9-1) 七朵花 · 糊里糊涂的买车记, Subaru XV (2013-4-24) Tictac999
Advertisement
Advertisement
查看: 1317|回复: 2

Issues when converting to MVC4 [复制链接]

2010年度奖章获得者

发表于 2012-3-2 11:49 |显示全部楼层
此文章由 dalaohu 原创或转贴,不代表本站立场和观点,版权归 oursteps.com.au 和作者 dalaohu 所有!转贴必须注明作者、出处和本声明,并保持内容完整
I keep getting this error when converting an existing MVC3 proj to MVC4
Any one run into the same issue and resolutions?


[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'. Type B originates from 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: [A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'. Type B originates from 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'.
足迹 Reader is phenomenal. If you never used, you never lived 火速下载
Advertisement
Advertisement

发表于 2012-3-2 12:21 |显示全部楼层
此文章由 典 原创或转贴,不代表本站立场和观点,版权归 oursteps.com.au 和作者 典 所有!转贴必须注明作者、出处和本声明,并保持内容完整
Referenc饿不对?
我见到过这个,你要不要试一下直接reference到一个dll文件上
...your project location\\\\AspNetWebPagesCore.2.0.10906.0\lib\net40\System.Web.Razor.dll

[ 本帖最后由 典 于 2012-3-2 11:25 编辑 ]

2010年度奖章获得者

发表于 2012-3-2 12:27 |显示全部楼层
此文章由 dalaohu 原创或转贴,不代表本站立场和观点,版权归 oursteps.com.au 和作者 dalaohu 所有!转贴必须注明作者、出处和本声明,并保持内容完整
found the issue,

I forgot up update the razor settings in Views/web.config!

发表回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Advertisement
Advertisement
返回顶部