The question is similar to this one, but I cannot figure how to make the formatting also apply to the ASP.NET server side tag <% %>
Like the related question, a block like this one
Good
<ul id="menu">
<li><%: Html.ActionLink("Home", "Index", "Home")%></li>
<li><%: Html.ActionLink("About", "About", "Home")%></li>
</ul>
Will get formatted into
Bad
<ul id="menu">
<li>
<%: Html.ActionLink("Home", "Index", "Home")%></li>
<li>
<%: Html.ActionLink("About", "About", "Home")%></li>
</ul>
I want to prevent Visual Studio from changing the formatting concerning asp.net server tag <% %>
.
Does someone know?
Nota: This is not a question about minifying the html output. This is for design time only. Its more of an annoyance 开发者_高级运维than anything else.
Try Tools -> Options -> Tree View Text Editor node -> HTML -> Format -> Tag Specific Options button -> Default Settings -> Client tag does not support contents -> In the Line breaks dropdown, select None.
The <% ... %> is seen by the editor as just another tag, in this case a Client tag that doesn't support contents.
精彩评论