Search code examples
resharperfubumvc

How can I get ReSharper Intellisense to work with Razor views in FubuMVC?


After following the recommendations in the following question's answers, I've been able to get Razor mostly working in FubuMVC.

Need razor view engine auto-complete to work in a class library?

However, the only way I can get Intellisense to work with the @model is to disable ReSharper's Intellisense. With R# 6, you can now specify limited R# Intellisense. Unfortunately, the only way to disable R# Intellisense for Razor is to disable the code in supported server pages; C# in my case. Doing so, also disables R# Intellisense for all C# files as well. That's definitely not ideal.

Currently, all ReSharper Intellisense is working in my Razor views as expected, except for the @model.

What does ReSharper need to be able to work properly with Razor views in FubuMVC? Am I just missing a reference, or should I create the web application as an ASP.NET MVC application instead of the recommended standard web application?


Solution

  • Take a look at the FubuMVC.HelloWorld project inside FubuMVC's source. There are a couple things required, your web.config needs to contain the compilation section, and the system.web.webPages.razor section. You must also add references to System.Web.Mvc, System.Web.WebPages.Razor, System.Web.WebPages.

    Everything described above is only necessary for the tooling. The implementation doesn't depend on any of those things being present.

    This may be improved a bit after RazorEngine implements a build provider, and we may do this for you when you add the nuget package.