I have and MVC3 project that once upon a time was an MVC2 project. I've been developing it using IIS express to test. Now I deployed it to IIS proper on my machine, jiggled some web.config settings, and messed around for an hour getting the razor build provider to be registered, which must not be done right because the new project template doesn't include a line adding that build provider in the web.config.
At any rate, any time I go to a strongly-typed Razor view I get this:
Compiler Error Message: CS0103: The name 'model' does not exist in the current context
Source Error:
Line 1: @model Cairn.Cartography.Features.Peak
Any thoughts on what is going on, and how I might fix it without firebombing this box and looking around for my windows install cd? :)
I was missing:
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
in this part of my web.config file:
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="Cairn"/>
<add namespace="Cairn.UI.Web"/>
<add namespace="Cairn.UI.Web.Helpers"/>
</namespaces>
</pages>
</system.web.webPages.razor>
I haven't the foggiest what this means or why it matters, or why it is absent from the web.config generated for a brand new project, but it works.
? Oh well
yes.. reinstall asp.net MVC3 again
either get the MSI file from here: http://go.microsoft.com/fwlink/?LinkID=208140
or use Web Platform Installer from here: http://www.microsoft.com/web/gallery/install.aspx?appid=MVC3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With