My recent projects list in Visual Studio is huge, so huge that it has become a annoying when I enter the Visual Studio Start Page.; it hangs and takes to respond. I create a lot of small projects in visual studio, and open a lot more. Every year I have around 300 C# projects from eager students to open and browse around. This gives me a lot of entries in “Open recent” of the visual studio start page, which can slow down opening the start page, pinning current projects and searching. This has bugged me for some time, and I’ve decided to prune a little. Problem is, you right click and remove one by one. We can do better.
Step one: locate the data
First hurdle is actually finding the place where these entries are stored. Google is not of much help, though there are nomourous entries with “how to clear MRU list” which are located in the registry hive file privateregistry.bin of the visual studio AppData/Local-dir. This however is not a solution as this is a separate list of only 10 (default). It isn’t obvious, at least to me, where the data is located, but after a five minute break (at least from VS), creating a new project and searching for modified files within the last 5 minutes (I used WSL/Ubuntu with
find . -mmin -5 -ls inside
/mnt/c/Users/thomas/AppData/Local/Microsoft/VisualStudio ), reveals that
16.0_19f5538c/ApplicationPrivateSettings.xml is the file we are looking for. The specific version directory, 16.xx may vary.
The recent (json)list
Inside the xml file, in the XPath “/
content/indexed/collection[@name='CodeContainers.Offline']/value” contains a Json string representing a list of recent projects. Using quicktype.io, static types for this content can be generated and looks like the snippet below
(I modified LastAccessed and the outer class from Welcome to FileEntry). The full version can be found on github: https://github.com/boegholm/FixVSOpenRecent
My list contains 600 items which makes visual studio performance suffer badly.
Pruning the list
I’ve pruned for project location on disk, whether it is pinned in my list (fav), and age in days. For this I have defined functions to be used with (readable) Linq:
With the pruning expression:
And saving updating the settings file:
I removed around 500 projects which are either student projects, from students which I no longer teach, or possibly abandoned projects. I guess my recent project list size is rather absurd compared to most, but perhaps someone will make a recent-editor some day!
The full source code can be found on GitHub https://github.com/boegholm/FixVSOpenRecent . Make sure you backup your files!