Click here to Skip to main content
13,897,366 members
Click here to Skip to main content
Add your own
alternative version


25 bookmarked
Posted 28 Jun 2005

Visual Studio Project MRU List Editor

, 28 Jun 2005
Rate this:
Please Sign up or sign in to vote.
A tool for editing the "Start Page" Recent Project List in Visual Studio .NET.


Anyone who has used Visual Studio to create more than one project or solution has used the "Start Page" to see the most recently used (MRU) projects or solutions. If you are like me, you often have more than one Visual Studio instance opened and have been frustrated by the fact that the list never seems to be "right". In addition I find myself often creating "temporary" projects to test a new idea and don't want to see these projects on my MRU Project List.

I have seen two articles on CodeProject discussing the "Start Page", but neither gave me an easy way to edit or maintain this list. The Stagner article speaks of maintaining the list by editing the registry, which in the end is all my tool does, but I wanted an interface to maintain the list.


Visual Studio stores the MRU Projects in the registry under the path HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\XX\ProjectMRUList where XX is the version number of Visual Studio.

  • Visual Studio 2002 - 7.0
  • Visual Studio 2003 - 7.1
  • Visual Studio 2005 - 8.0

There is a string value for each recent file named File1, File2, File3, etc. with a value of the full path to the file. Visual Studio updates this list on close, which is the root of some of my problems. Multiple versions of Visual Studio do not communicate about their open projects, nor do they read the current state of the registry and attempt to merge them. On close, Studio clears this key and re-writes out the list as it knows it. My scenario is as follows:

  • Open a copy of Visual Studio and create Project 1
  • Open a second copy of Visual Studio and create Project 2
  • Close the second copy of Visual Studio. Project 2 is written out to the Registry.
  • Close the first copy of Visual Studio. The Key is cleared and Project 1 is written out to the Registry.
  • Open Visual Studio again to find that it "forgot" about Project 2.

Important Note

Since Visual Studio clears and rewrites the list on close, you must have all instances of Visual Studio before using this tool.

Using the code

There is no real magic in this code; one listbox, six buttons and some Registry code.

Since we are using the Registry, we need to include the Microsoft.Win32 namespace.

using Microsoft.Win32;

On the form load we open the key in a writable mode:

private void MainForm_Load(object sender, System.EventArgs e) {
    // Open a writable RegKey
    m_ProjectMRUKey = Registry.CurrentUser.OpenSubKey(PROJECT_MRU_PATH, true);

Loading and daving methods:

/// Loads (Reads) Registry Values into ListBox
/// </SUMMARY>
private void btnLoad_Click(object sender, System.EventArgs e) {
    foreach (string key in m_ProjectMRUKey.GetValueNames()) {

/// Save (Writes) Registry Values from ListBox
/// </SUMMARY>
private void btnSave_Click(object sender, System.EventArgs e) {
    foreach (string key in m_ProjectMRUKey.GetValueNames())

    for(int i=0; i < lstBoxMain.Items.Count; ++i) {
        m_ProjectMRUKey.SetValue("File" + (i+1), lstBoxMain.Items[i]);
    //Flush the object to force it to write the files to the Registry

Form closing - Close the Registry key:

private void MainForm_Closed(object sender, System.EventArgs e) {
    //Close and flush the registry value on close

The rest of the code deals with maintaining the ListBox by removing the selected item, or moving it up or down in order. There is also an Add button to create a new item in the list for unknown projects. Note that the OpenFileDialog called in the Add function only filters to look for a small subset of the total Visual Studio supported file types. It was enough to suit my needs and I added an "All Files" filter as a catch-all.

Final Thoughts

As the radio cliché goes, "I'm a long time listener first time caller to CodeProject". I hope this simple article is useful to those who take the time to read it. I use this tool all the time and have found it very helpful. Depending on how my experience with this article goes, I will hopefully be back to lend more tips and tricks to the coding community. I look forward to your comments and / or questions.


  • Version 1.0: Initial release.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Josh Beach
Web Developer
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralLatest version Pin
peterchen6-Apr-07 0:26
memberpeterchen6-Apr-07 0:26 
Generalstart page Pin
Moekie3-Oct-06 0:46
memberMoekie3-Oct-06 0:46 
GeneralModified the MRU program Pin
Achintya Jha12-Sep-06 10:13
memberAchintya Jha12-Sep-06 10:13 
GeneralRe: Modified the MRU program Pin
J. Beach12-Sep-06 16:05
memberJ. Beach12-Sep-06 16:05 
GeneralRe: Modified the MRU program Pin
Achintya Jha13-Sep-06 4:27
memberAchintya Jha13-Sep-06 4:27 
GeneralWack them projects away Pin
IC1826-Jun-06 10:18
memberIC1826-Jun-06 10:18 
QuestionThe name 'm_ProjectMRUKey' does not exist in the current context Pin
snowlin12-Jun-06 11:41
membersnowlin12-Jun-06 11:41 
AnswerRe: The name 'm_ProjectMRUKey' does not exist in the current context [modified] Pin
Josh Beach12-Jun-06 17:43
memberJosh Beach12-Jun-06 17:43 
GeneralAt last, success .... Pin
Khurram Hassan12-Apr-06 20:16
memberKhurram Hassan12-Apr-06 20:16 
GeneralA wonderful tool! Pin
Troye Stonich27-Dec-05 6:46
memberTroye Stonich27-Dec-05 6:46 
GeneralList ordered by dates Pin
ChrisFrazier7-Jul-05 8:56
memberChrisFrazier7-Jul-05 8:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02 | 2.8.190306.1 | Last Updated 28 Jun 2005
Article Copyright 2005 by Josh Beach
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid