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.
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
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.
You may also want to try this:
- Options
- Text
- Editor
- HTML
- Advanced
- Format on paste: False
- Enable validation: False
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?
Try
Tools -> Options -> Text Editor -> Html -> Advanced
then set "XHTML coding style" false
and set "Format on paste" false