Visual Studio XML File Editor

I am editing cshtml in Visual Studio (with a .cshtml file extension). I automatically format or paste into some xml (which starts the automatic format), and Visual Studio reduces all my xml attributes (so the> theattribute attribute).

It is not right. How can i fix it? I do not see the corresponding option in the Tools> Options section.

+6
source share
4 answers

I did not find a way to configure this behavior, but as a workaround, you can explicitly choose the editor that will be used with * .cshtml files, and then it works correctly.

Go to Tools -> Options -> Text Editor -> File Extension

enter image description here

PS It seems that the settings for the HTML text editor (Razor) were provided in a separate node, but I do not see it in the VS 2013 release. See HTML editing options in Visual Studio 2013 Preview

I also saw that Tools -> Options -> Text Editor -> HTML (Web Forms) -> Formatting has options that specifically indicate the behavior you are getting.

+6
source

You can also try the following:

  • Options
    • Text
      • Editor
        • HTML
          • Advanced
            • Insert Format: False
            • Enable Verification: False
+1
source

Tools-> Options-> Text Editor-> XML-> Formatting (*) Save attribute formatting manually

also disable other settings. Do you have a Resharper or something else that might affect it?

0
source

Try Tools → Options → Text Editor → Html → Additionally, then set the “XHTML encoding style” to false and set the “Format on insert” false

0
source

All Articles