Home > database >  Where does VSCode store its Most Recently Used (MRU) list of .NET projects and solutions on Windows?
Where does VSCode store its Most Recently Used (MRU) list of .NET projects and solutions on Windows?

Time:11-16

Where does VSCode store its Most Recently Used (MRU) list of .NET projects and solutions on Windows?

And also is there some open source code to fetch VSCode's MRUs?

I scanned all files in this dir (recursive) C:\Users\pat\AppData\Roaming\Code with no luck

CodePudding user response:

For you it should be in C:\Users\pat\AppData\Roaming\Code\User\globalStorage\state.vscdb; this file is an SQLite database and you can look around for tools that open this kind of file (because it won't be readable as plain text) to see what's inside and decide whether you can sync it across machines (if that's what you're after).

Also reference this answer, there's very useful stuff over there.


Edit: Thanks this is indeed the file I was looking for.

It can be read with the tool SQLitebrowser.

I didn't easily found a .NET library to read the state.vscdb file we are very reluctant in embedding a whole library in our product for a small feature.

Hopefully state.vscdb contains the MRU file list in clear textual JSON. So what I did is just open this file as text, and locate the JSON and read it. Clearly it is ugly but JSON shouldn't be crypted anytime soon in such file and if it fails one day, this feature is not critical for us, just a convenient helper for the user.

The JSON to locate looks like:

{"entries":[
{"fileUri":"file:///c:/Dir/treeItem.ts"},
{"fileUri":"file:///c:/Dir/YourSolution.sln"},
...
  • Related