Razor view not recognizing @model or Lambda @Html

2019-06-27 10:38发布

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.

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

Any ideas?

1条回答
何必那么认真
2楼-- · 2019-06-27 11:14

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.

查看更多
登录 后发表回答