Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio doesn't recognize @model directive

I'm having trouble getting Visual Studio to recognize the @model directive in MVC3. As a result, I'm not getting any Intellisense help. For example, I just loaded up the standard base MVC3 project in Visual Studio and it shows all sorts of errors in LogOn.cshtml since it can't figure out what the view model is. However, if I run the application everything works just fine. So I guess this is more of an annoyance than anything else.

like image 758
Kyle Avatar asked May 21 '26 15:05

Kyle


1 Answers

If you have installed the ASP.NET MVC 3 Tools Update make sure you have set the webpages Version in your web.config:

<appSettings>
    <add key="webpages:Version" value="1.0.0.0"/>
    ...
</appSettings>

Then simply close and reopen the view and syntax highlighting and Intellisense should come back.


UPDATE:

Reinstalling ASP.NET MVC 3 Tools Update solves the problem.

like image 138
Darin Dimitrov Avatar answered May 23 '26 20:05

Darin Dimitrov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!