开发者

Reformat XML in Visual Studio 2010

Is there an easy way to reformat an XML file while viewing it Visual Studio 2010. For example, if you open a generated app.config file, it might look like:

<?xml version="1.0"?>
&开发者_开发知识库lt;configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

This is difficult to read, is there a way to instruct Visual Studio 2010 to format this, so that it looks more like:

<?xml version="1.0"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

Thanks for any help.

Update: With credit to Julien Hoarau for one of the answers. The answers are:

Edit -> Advanced -> Format Document (Ctrl+K, Ctrl+D)
Edit -> Advanced -> Format Selection (Ctrl+K, Ctrl+F)


Yes you can :

Edit > Advanced > Format document (Ctrl+K Ctrl+D)


If you want to leave your right hand free to do something else, you can use Ctrl+E, Ctrl+D.

Not sure how this is different from Ctrl+K, Ctrl+D.


Not 100% sure about VS2010, but in VS2015 if you copy and paste a long string of XML into an .XML document, it will automatically reformat it.

("Format Document" is usually the way to go, just mentioning another option.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜