Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does resharper have problems with asp.net mvc?

I'm using the latest release of resharper. Just downloaded and installed last week so I'm new to using it. The problem I'm having is that in my ASP.NET MVC application all of my controllers say they are never used and all the methods within the controller say they are never used.

Is there a way to suppress the messages or for resharper to understand they are used?

like image 684
Mike Roosa Avatar asked Dec 06 '22 06:12

Mike Roosa


1 Answers

You can turn on/off the various warnings and hints that Resharper gives you.

HOWEVER, if you write unit tests then they WILL be used and Resharper will be happy.

update

You could consider telling Resharper to ignore the unused members of your controller by doing this at the top and bottom of your controller class...

public class MyController: Controller
{
    // ReSharper disable UnusedMember.Global

    ...        

    // ReSharper restore UnusedMember.Global
}

... or, at least put these comments around the public methods on your controller (I use StyleCop and so all the public methods will be grouped together anyway. This is reasonably unobtrusive, and would get rid of this warning from Resharper.

like image 122
Martin Peck Avatar answered Dec 09 '22 14:12

Martin Peck