Your official information source from the .NET Web Development and Tools group at Microsoft.
Many of us follow a modular architecture and create MVC3 Razor view in a separate class library project.
Following is a screenshot of the class library project that I have created.
Now if I open a view with @model typed in it, I notice that it shows squiggle for @model and no intellisense is shown. (error: There is build provider registered for the extension '.cshtml')
The reason behind the error is that Visual Studio 2010 (for Razor tooling) requires web.config file (with some specific settings) to be in the project so that the MVC Razor host (which adds the @model directive) gets registered correctly.
The workaround would be to drop the attached web.config (rename the attached file from web.txt to web.config) to the root of the project. Close, reopen the file and Boom, intellisense is back for @model inside the class library project.
Hope this helps,
How do you use these views within host application ?
I've recently found this solution: www.chrisvandesteeg.nl/.../embedding-pre-compiled-razor-views-in-your-dll and after reading this post I feel that I miss something here?
Or maybe you just xcopy your views to the hosting app Views directory using AfterBuild event - or similar thing?
Thank you I've been looking into this all day.
This did not work. Also be careful if you use this, your version of MVC may be different. Also do not replace your entire web.config with this one. Your's will likely have many other entries that are required by your environment.