views:

306

answers:

2

Is it possible to disable Resharper 4.5 naming suggestions in markup files such as aspx and ascx?

It gets annoying when every single server control is underlined and displays a message like "Name 'ddlDefect' does not match rule 'Fields (not private). Suggested name is 'Defect'.

<asp:DropDownList ID="ddlDefect" runat="server" />

I know that I can add additional rules, but that would affect all non private fields in my classes, and I'd rather not do that.

+2  A: 

I don't know of a way to turn this off, and I don't think it would be wise to do so. The declaration you've posted actually declares a field named "ddlDefect". Why not treat it like any other field with the same name? Why treat it differently simply because you declared it using markup and not code?

John Saunders
Because my project's naming conventions for server controls is different from that of normal class fields. If it was a small task to rename all DropDownLists from ddl<name> to <name>DropDownList, I would. But unfortunately, my project is way too big for that.
jrummell
I suggest the following: if you're like me, your projects name server controls differently because of standards that existed before ReSharper could do anything about naming them. You might revisit that convention to decide if there's a good reason for fields that are server controls to be named differently from fields that are not server controls. If you want to change, ReSharper can safely change the name, admittedly on a one-by-one basis.
John Saunders
That's what I was thinking, but it would take too long to do it. But I suppose I could rename the server control fields one page/control at a time as I add or edit them.
jrummell
There's nothing wrong with doing it incrementally.
John Saunders
A: 

You can force ReSharper to interrogate event names globally or specifically for C# or VB. Check out my answer in the following post:

http://stackoverflow.com/questions/2994774/resharper-conventions-for-names-of-event-handlers

dnorthut