Hello @Mohammad Mohsin Siddiqui ,
Welcome to Microsoft Q&A forum.
Sometimes, Code Cleanup feature helps to auto save the file(s) when you run it, which means if you don’t save the modified file(s), but directly run the Code Cleanup(and the formatter detects that some code need to be formatted) from Analyze > Code Cleanup > Run Code Cleanup (Profile X) on Solution, then the modified file(s) will also be formatted and auto saved. Of course, if no code is detected to be formatted then the file will not be formatted and auto saved.
There’s a quick/easy way to find out whether the opened, modified file(s) have been saved. You can see that there’s a * after your file name if you modified the file or when you are editing this file. It will disappear after you/VS save it.
So is there any way to call save again post-calling format document? Or any other way to solve this?
I’m afraid, there’s no other way currently.
BTW, there’s an option for auto saving files(Tools > Options > Environment > Documents > Automatically save files when Visual Studio is in the background).
Sincerely,
Tianyu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.