I am trying to configure RazorEngine so that intellisense works on views. I add RazorEngine and Microsoft.AspNet.Mvc using nuget. I create TestView.cshtml and declare @model MyModel
but it says The name 'model' does not exist in the current context
. I also cannot use intellisense inside the view.
Do I miss any step here? How to enable intellisense in the View?
You can use
on the top of your template.
This works fine on a new Console Application with Visual Studio 2013 (after adding a reference to RazorEngine). The documentation for this is here.
EDIT:
I noticed that this only works when the RazorEngine project is added to the solution and directly referenced. If you use the NuGet package you additionally need to ensure one of the following to make it work:
bin\
instead ofbin\Debug\
andbin\Release\
.RazorEngine.dll
andSystem.Web.Razor.dll
tobin\