I rely on clean-up profile with the “run on save” checked to ensure my code is formatted on save:
‘Format code’ and ‘sort using’ on save in Visual Studio 2022
While that feature works well for code files (.cs…) it seems it was not intended to support .cshtml
files (notice when the current opened document is a .cshtml
, there is no cleanup icon in the status bar next the zoom option).
I can do it manually through: “Edit > Advanced > Format Document” (CTRL+E, D), also I am aware that there is an option called “Format HTML on paste”, but I am looking to automatically trigger the formatting upon save.
I have done some research here, unfortunately I cannot find an up-to-date working solution (or specific stable extension) for VS2022.
PS: I am not interested to install a large or/and paid extension (like Resharper) just to use this one specific feature.