Visual Studio 2008 formats asp tags to lowercase

2019-01-28 17:37发布

问题:

Recently, my Visual Studio 2008(with Resharper 4.5) has started to reformat asp tags into lowercase.

Example:

<asp:Repeater runat="server" id="rp">

becomes

<asp:repeater runat="server" id="rp">

and I can't find a way to make it not do this. I use Ctrl-k Ctrl-d to reformat.

I've tried resetting the Visual Studio settings, turning off Resharper. Nothing seems to bite.

I did delete a huge Reflected something folder in my Documents and Settings folder last week, could this be the reason?

回答1:

I had the same (or very similar) issue.

I also deleted some (but not all) files in the folder

C:\Documents and Settings[username]\Application Data\Microsoft\VisualStudio\9.0\ReflectedSchemas

The reason I did this is because I'm subject to a frankly daft limit on the size of my (Windows XP) roaming profile :-(

After I did this VS intellisense and document auto-formatting started behaving as if it didn't know what the <asp: tags were and treated all the html as plain html (formatted tag names and attributes in lowercase).

I found this blog post by Tim Vasil which pointed me to the solution.

Here's what I did to fix this:

  1. Deleted all files in C:\Documents and Settings[username]\Application Data\Microsoft\VisualStudio\9.0\ReflectedSchemas

  2. Deleted all files in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files

  3. Deleted the .suo User Option file (the file has the same name as the solution file with .suo in place of .sln)

(Note: VS eventually regenerates the various files in it's own time...)



回答2:

Go to Tools | Options...

Expand: Text Editor - HTML

Select the "Format" node, and see what settings you have for "Capitalization" of "Server tag" and "Server attributes - I think the default is now "Lowercase" - try setting that to "Assmebly definition" instead.

More information on these options can be found here:

Format, HTML, Text Editor, Options Dialog Box



回答3:

I found the cause. I put back that 650MB big folder in C:\Documents and Settings\My User Id\Application Data\Microsoft\VisualStudio\9.0 and everything seems to be back to normal.

Thanks for trying to help me!



回答4:

I'm not sure about a permanent fix, but what you can do is select the troublesome coding then hit CTRL+K followed by CTRL+F, so in order..

CTRL + K, F

This will auto format the coding (and make it the proper case). If this doesn't work then it might be an auto-format issue/setting