4

Is there any tool for Visual Studio 2008 which can reformat ASPX code to make it more presentable (eg insert line breaks, format the lines so they wrap when necessary, etc)?

Thanks

6 Answers 6

18

Have you tried hitting Ctrl+K+D? Is this what you're referring to?

Sign up to request clarification or add additional context in comments.

1 Comment

if you have the error "could not format document due.." look for the line and check if you have any extra ";" or other character that may cause the error.
2

http://blogs.msdn.com/markhsch/archive/2008/01/10/visual-studio-tip-autoformat-your-code.aspx

To have Visual Studio fix it all up nice and tidy for you, select the text, hold CTRL and hit K followed by F (CTRL+K-F). What I usually do is do a CTRL-A to select all text then do the CTRL+K-F combo. Voila!

Comments

1

You can also do it from the menu Edit > Advanced > Format Document or toolbar.

alt text http://img148.imageshack.us/img148/8872/formatdoc2.png

Comments

0

There are actually a number of tools dedicated to code formatting that you might want to take a look at. Visual Studio's formatting capabilities are actually quite limited, and a lot of projects I have worked on use one of these external tools.

Good luck!

Comments

0

This may not be directly related to your issue, but DevExpress has a free product CodeRush Express that will not only help with tidying but has a great interface for refactoring. Here is a link to their demo video. I've used their products for a few years and they really up your productivity.

Comments

0

After 11 years there is still no tool that does it right. All online formatters I found dont cope well with ASP (.NET/Core/Blazor) tags, and VS20xx (even the latest 2022) doesn't deal with tags from custom controls, it formats all, except for sections within custom tags. In my case, 90% of the aspx files.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.