28

I recently upgraded to using ReSharper 5 (currently in beta). I noticed that in ASP.Net MVC projects, ReSharper underlines in red all of the return statements inside a controller:

Annoying Red Underlines

I personally find this pretty annoying because it looks like an error. Clicking on the underlined text doesn't offer any help (ie, a lightbulb). I don't see an option to change the styling of this text in Environment -> Fonts and Colors, and so far it looks like the only way to disable it is to un-check the "Enable ASP.Net MVC References" in the ASP.Net -> Other Re-Sharper options.

What's the point of this highlighting? Am I missing out on something special that ReSharper is offering me? Is there a way to remove the highlighting while still enabling MVC support in ReSharper?

3 Answers 3

27

It's not red - it's brown. It matches color of string literals in standard VS color scheme.

To change it's color:

  1. Install ReSharper 6+
  2. Within Visual Studio navigate to ToolsOptionsEnvironmentFonts & Colors
  3. Scroll down to ReSharper ASP.NET MVC * and change the Item foreground color (and Item background if you'd like) to whatever color suits you best. In your specific case you'll want to change the Item foreground of ReSharper ASP.NET MVC View.

If at the third step you can't find the ReSharper items you should reset the Fonts & Colors cache manually by deleting the HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\FontAndColors\Cache key in the registry (You may have to delete the key located in ...\10.0\..., too.)

3
  • 1
    It's #a52a2a, which is definitely in the red shade of colors. It's just a lot less noticeable on a light background. Thanks for the tip on clearing the font and colors cache - that was the issue. I now see the ReSharper MVC settings and can modify them. Mar 11, 2010 at 16:37
  • Did you try scrolling up and down? My underline did not change colour until I scrolled up and down.
    – BarrieK
    Oct 2, 2019 at 14:00
  • Any idea guys how to turn this feature off completely? Or make it incivible? I don't see anything about underline in the font & color options =/
    – mikus
    Oct 11, 2022 at 16:32
9

Resharper smartly identifies the real view/controller/actionmethod your referencing by magic string. Do a Find Usagages and you'll see you can navigate to the view or controller.

1
  • 1
    This is the answer to the asked question "What's the point of the red underline?" Jan 31 at 6:34
5

The underline is used for two purposes:

  1. To indicate that the View/User control exists.
  2. You can navigate to it directly by clicking on it with the mouse button and hitting the Ctrl key (or F12 in VS Scheme Binding).

The idea here is to make you aware of missing views. It's only red (the text itself) when a View is missing and hitting Alt plus Enter, you'll get the Create from Usage possibility.

3
  • 2
    are you sure that it's only red when the view is missing? I have it underlined although the view is present :( On some other controller there is no underlines... strange. I use ReSharper 7.1
    – davidhq
    Apr 30, 2013 at 13:17
  • The actual color of the text (not the underline) is red when the view is missing. I think the underline just lets you know you can navigate to it.
    – firecape
    Apr 28, 2014 at 9:46
  • 1
    The text is red if the view isn't recognized. However, this question is asking about the red(ish) underline.
    – Cerbrus
    Dec 11, 2017 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.