剃刀视图无法识别@model或Lambda @HTML方法 [英] Razor view not recognizing @model or Lambda @Html methods

查看:47
本文介绍了剃刀视图无法识别@model或Lambda @HTML方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Razor视图时遇到了最奇怪的问题.我有两个不同的项目,一个很好,而另一个则没有.但是非常奇怪的是,对于无法正常工作的项目,另一位同事具有相同的代码和相同的Visual Studio 2013 ,并且对他来说效果很好.我最初的想法是我正在使用的web.config和引用,但是我更新到了最新的MVC 5.2 nuget程序包,但它仍然无法正常工作.

I am having the strangest issue using Razor views. I have two different projects and one works fine and the other doesn't. But the very odd thing is for the project that doesn't work, another colleague has the same code and same visual studio 2013 and it works fine for him. My first thoughts were the web.config and references I was using but I updated to newest MVC 5.2 nuget package and it still doesn't work.

当我在顶部键入 @model 时,它不知道它是什么,并且行为不应该存在,并且当我键入 @ Html.HiddenFor(x =>x.Name),甚至都不知道 HiddenFor 是什么.如果我运行该页面,它将起作用,但是在开发页面时,它将模型视为动态类型,而我根本无法使用智能感知.我也已经删除了suo文件.

When I type @model at top it doesn't know what it is and acts like it shouldn't be there and when I type @Html.HiddenFor(x => x.Name) it doesn't know what HiddenFor even is. The page will work if I run it but when developing the page it sees the model as Dynamic type and I can't use intellisense at all. I already deleted the suo file too.

更新:即使使用

Update : Even this doesn't work @using (Html.BeginForm....

有什么想法吗?

推荐答案

您可能要检查 Views 文件夹中的 web.config 文件,并确保所有版本号与 root 中的 web.config 相同.

You may want to check the web.config file in the Views folder and make sure all the version number are the same as the web.config in the root.

这篇关于剃刀视图无法识别@model或Lambda @HTML方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆