Last post Apr 03, 2015 03:17 AM by harrison.scott
Apr 02, 2015 11:17 AM|jerrylefou|LINK
In all my views files, in the model declaration, @model word is underlined with error: The name 'model' does not exist in the current context. Runtime, it runs fine but I have no more intellisence in my cshtml files :(
I've tried every solution found in different forums. Lot of solutions talk about versions problem in web.config files, this is NOT my problem. My coworker has the exact same web.config files on his computer and everything is working fine for him. I've been
able to reproduce the problem on a brand new computer with a brand new solution downloaded from my source control and freshly restored NuGet packages.
Visual Studio 2013
I've been wasting 2 days on this problem, need help
Apr 02, 2015 12:23 PM|Rion Williams|LINK
Could you post what one of your example Views looks like in it's entirety? The only thing that I could think of is that the type of Project that you are using wasn't originally created with the appropriate MVC references or is missing proper namespace references
within your web.config (within your Views folder) :
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
However you mentioned that your co-worker isn't having any issues using the same exact code and markup. Do you have any extensions installed within Visual Studio such as Resharper? You might also try explicitly restarting Visual Studio and running it as
an Administrator (or explicitly restarting your machine). It could be an issue with your Visual Studio installation as well.
Is the issue limited to this particular project or is it not working for any solution?
Apr 02, 2015 12:44 PM|jerrylefou|LINK
HI Rion, thanks for the reply, really appreciate it!
First, I've changed the <host> tag accroding to what you have wrote in your answer, I still had version 4, but no luck it is still broken :(
Do i have to restard Visual Studio when I make changes to the web.config?
I do not have resharper installed on this machine.
I tried to create a new empty MVC project and it works fine, so the problem is really related to this particular solution.
I could paste my view but I don't think it could help, even with a brand new view like the following
ViewBag.Title = "MyTestView";
@model and ViewBag are underlined
Apr 02, 2015 08:06 PM|jaydee777|LINK
Did you try to rebuild the application what happen if you run it F5?
Apr 03, 2015 02:49 AM|Starain chen - MSFT|LINK
You may try to remove the MVC package form your project and re-add the package again, then rebuild your project and check the result. (Manage nugget package)
If it still not work, I think you need to create a new project, then add the old project’s file to the new project.
Apr 03, 2015 03:17 AM|Harrison.Scott|LINK