CodeMaid is a very popular Visual Studio extension and does this automatically along with other useful cleanups.
- Download: https://github.com/codecadwallader/codemaid/releases/tag/v0.4.3
- Modern Download: https://marketplace.visualstudio.com/items?itemName=SteveCadwallader.CodeMaid
- Documentation: http://www.codemaid.net/documentation/#cleaning
I set it to clean up a file on save, which I believe is the default.