Votes

Share

I realize now that the content within the <% %> tags is considered C# code and is getting formatted with those rules. Is it possible to add some kind of pragma that disables formatting for a specific file?

I think this issue needs serious attention. I think code cleanup has become almost useless in ASP.Net MVC projects given that <% %> block code is common and these blocks are now made entirely ugly by the c# reformating rules being applied to them. So much so that unless there is some option to apply different formatting rules for code inside of aspx pages OR formatting can be disabled for these pages, then I am going to have to advise my team to stop using the feature for the MVC web app project. This is a BIG shame as its a feature I like quite a lot.

And yes I know its possible to pick the files you want to clean, but this is generally impractical. Its only really practical to reformat on a project or solution wide basis.

Sorry not to be more specific. I think code mixed in markup is ugly in general, but Resharper takes away flexibility in how I format it, unless I want to constantly change it.

For instance, if I want to generate a bunch of similar tabs in a loop... Any time I type in a curly brace, the whole block of code gets reformater to resharpers preference. I would like to keep the loop code tight, so it doesn't take too many lines and is readable:

I really don't want a whole line for the curly brace, but thats what I get. It is true that my code formatting is setup to have curly braces on the next line, that is my preference for CS files, but in ASPX it is ghastly to read.

Sorry not to be more specific. I think code mixed in markup is uglyin general, but Resharper takes away flexibility in how I format it,unless I want to constantly change it.

For instance, if I want to generate a bunch of similar tabs in aloop... Any time I type in a curly brace, the whole block of codegets reformater to resharpers preference. I would like to keep theloop code tight, so it doesn't take too many lines and is readable:

<% for (int i = 0; i < count; i++) { %><div id="div<%= i %>"></div><% } %>Resharper will frequently reformat the code as I type, and give mesomething like this:

<% for (int i = 0; i < count; i++){%><div id="div<%=i%>"></div><%}%>I really don't want a whole line for the curly brace, but thats whatI get. It is true that my code formatting is setup to have curlybraces on the next line, that is my preference for CS files, but inASPX it is ghastly to read.