I'd like Visual Studio to continue automatically formatting my .cs
files, but is there a way to prevent it auto-formatting C# code in between the <% %>
tags in ASP.NET MVC views because it really makes a mess of it?
As far as I know there isn't a way to turn off the formatting just in ASP.NET files as it uses the rules for C# in Tools -> Options -> Text Editor -> C#.
There is no way to do it and it is a huge time waster fixing up the formatting in .aspx pages over and over again. It drives me nuts.
There are two connect issues/bugs for this. One was marked as fixed for months but the latest response does not look like anything was even done.
https://connect.microsoft.com/VisualStudio/feedback/details/514691/add-aspx-or-inline-c-as-an-option-in-text-editor-formatting-options
https://connect.microsoft.com/VisualStudio/feedback/details/586729/support-c-formatting-options-for-aspx-pages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With