Jeff
Jeff

Reputation: 36563

Visual Studio XML File Editor Lowercase

I'm editing cshtml in Visual Studio (with a .cshtml file extension). I auto format or paste in some xml (which triggers an auto format) and Visual Studio lowercases all my xml attributes (so theAttribute > theattribute).

This is wrong. How can I fix? I don't see a relevant option under Tools > Options.

Upvotes: 7

Views: 1432

Answers (4)

yoni12ab
yoni12ab

Reputation: 21

Try Tools -> Options -> Text Editor -> Html -> Advanced then set "XHTML coding style" false and set "Format on paste" false

Upvotes: 0

Tatiana Racheva
Tatiana Racheva

Reputation: 1304

You may also want to try this:

  • Options
    • Text
      • Editor
        • HTML
          • Advanced
            • Format on paste: False
            • Enable validation: False

Upvotes: 1

Anton
Anton

Reputation: 326

I haven't found a way to configure this behavior, but as workaround you can explicitly select editor to be used with *.cshtml files and then it works properly.

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

enter image description here

P.S. It looks like there were plans for HTML (Razor) text editor settings in a separate node, but I don't see it in release of VS 2013. See HTML Editing Features in Visual Studio 2013 Preview

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

Upvotes: 6

shark92651
shark92651

Reputation: 83

Tools->Options->Text Editor->XML->Formatting (*) Preserve manual attribute formatting

also, uncheck the other settings. Do you have Resharper or something else that could be affecting it as well?

Upvotes: 0

Related Questions