Resharper can't recognize valid controller action when using WebApi 2.0 UrlHelper

I just started using Resharper. I am using the latest version.

My project is an MVC app with WebApi 2.0 and since I have to send email with links back to the application, I find myself using the WebAPI version of the UrlHelper (from System.Web.Http.Routing, not the one from System.Web.Mvc). 

I have found that Resharper has this great feature where it can tell if the controller and action specified in the System.Web.Mvc.UrlHelper is a valid controller/action combination. But it doesn't seem to be able to do the same for System.Web.Http.Routing.UrlHelper. I have this code:

```

urlHelper.Link("default", new { controller = "MyController", action= "MyAction"... )

```

And Resharper is flagging this as an error because it can't determine that MyController.MyAction exists, when in fact it does exist. Maybe it is trying to find MyController as a WebApi controller rather than an MVC controller. This form, with the "default" in the front means that I am looking up an MVC controller. 

 

Does anyone know how to get Resharper to do the right thing with this?

0
1 comment

Hello Greg Veres

Could you share a sample solution illustrating the issue?

0

Please sign in to leave a comment.