I really love this new feature of VS2008 that allows you to cleanup the 'usings' section of C# files (and I've been always missing this from Eclipse) but I was a bit disappointed when I found there is no choice to execute automatically before every save. Somebody please tell me if I'm wrong!
As I'm little paranoid I wrote this simple macro and reassigned the 'CTRL+S' shortcut to it. The try/catch is needed because it will fail with no C# editors.
Public Sub RemoveSortAndSaveSelectedItems() Try DTE.ExecuteCommand("Edit.RemoveAndSort") Catch End Try DTE.ExecuteCommand("File.SaveSelectedItems") End Sub
Now this will be on my list of the very first things to do when reinstalling a development machine ;-).