Sub FormatAll() For Each proj As Project In DTE.Solution.Projects FormatFileRecur(proj.ProjectItems()) Next End Sub Sub FormatFileRecur(ByVal projectItems As EnvDTE.ProjectItems) For Each pi As EnvDTE.ProjectItem In projectItems If pi.Collection Is projectItems Then Dim pi2 As EnvDTE.ProjectItems = pi.ProjectItems Try If pi.Name.EndsWith(".cs") Then If Not (pi.Name.EndsWith("Designer.cs")) Then If Not pi.IsOpen Then pi.Open(Constants.vsViewKindCode) pi.Document.Activate() DTE.ExecuteCommand("Edit.FormatDocument") If Not pi.Document.Saved Then pi.Document.Save() pi.Document.Close() End If End If Catch ex As Exception 'Ignore this error - some project items cannot be opened. End Try If pi2 IsNot Nothing Then FormatFileRecur(pi2) End If End If Next End Sub
I just realized that my Windows directory has over 34 GB of stuff. What the heck!!! When you have Office, a couple of versions of Visual Studio, and few other Microsoft programs, you basically have already gobbled up about 80 GB of hard disk space. I found this online and found it to be useful and effective. It shaves off about 8 GB of your Windows folder. Still not what I had expected but I can definitely use 8 GB for other important documents. I'm just puzzled at what is Micros soft putting in an Operating system folder? huh? 28 GB of crap? Open a command prompt (make sure you either have Admin privileges). If you do not have Admin privileges, then open the command prompt as Admin. dism /online /cleanup-image /spsuperseded /hidesp