I'm having a problem that VS (2015) complains about some things i my .cshtml views.
"The name 'model' does not exist in the current context"
@model Project.MyModel
'HtmlHelper' doesn not contain a definition for a 'TextBoxFor' and no extension method 'TextBoxFor' accepting a first argument of type 'HtmlHelper' could be found (are you missing a using directive or an assembly reference?)
@Html.TextBoxFor(x => Model.Property)
I can't figure out why it's like this.
My Views/Web.config
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
</system.web.webPages.razor>
My Web.config
pages>
<namespaces>
<add namespace="System.Web.Helpers"/>
<add namespace="System.Web.Mvc"/>
<add namespace="System.Web.Mvc.Ajax"/>
<add namespace="System.Web.Mvc.Html"/>
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing"/>
<add namespace="System.Web.WebPages"/>
</namespaces>
</pages>
Can anyone see what I'm missing here?
EDIT: It works fine in VS 2013..
<bindingRedirect .. newVersion=".." />against all you version numbers in the web.config file for a version mismatch - user3559349<appSettings> <add key="webpages:Version" value="3.0.0.0" />Try changing above value3.0.0.0to2.0.0.0in your web.config. Build solution and open the view. - John