Rahul Soni's blog

Never assume the obvious is true!

Visual Studio 2008 - More control over Recent Projects list in Start Page

Visual Studio 2008 - More control over Recent Projects list in Start Page

  • Comments 16

If you work with a lot of samples, the chances are quite likely that you will end up in a rather dirty list of Recent Projects List in Visual Studio. I'm personally quite nit-picky and I really hate it when I find something like this...

image

Now... I don't know which of these Samples should I click on (since I have two in the list!). Anyway, there are multiple reasons why you would like to remove the junk entries from this list. One way is to open the Registry and navigate to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\ProjectMRUList. This list contains all the values you are looking for. Delete the values which you don't like and restart Visual Studio.

Another way, which I think is a smarter one is to download this ZIP and do the following...

1. Extract it anywhere in your machine.
2. Open Visual Studio, click on Tools -> External Tools...
3. Click on Add button and in the Title field, write "Clear Recently Used List"
4. In the Command Line, browse to the <SAVED__PATH>\ClearRecentItems.exe and click on OK.

image
4. Now, you should have this tool listed on your Tools Menu in VS 2008.

image

5. Here is the sample output...

image

Feel free to download the code for this small utility...

Download 

Hope this helps, Wave
Rahul

  • It would be better if Visual Studio had a built-in tool where developers could manage the Start page. For example, it should allow selective removal of projects by right-clicking on the project name.

  • Nice tool - but it is Visual Studio 9 aka Visual Studio 2008 ;-)

    --

    SvenC

  • Kjopc,

    I agree with you, totally! If you feel strongly about it, feel free to give feedback at http://connect.microsoft.com/VisualStudio/Feedback

    SvenC,

    Thanks for pointing out :-) My bad, just corrected it.

    Cheers,

    Rahul

  • .NETOpenCSV#Explorer-AVisualStudio2005add-inwhichinteractswithWindowsExplorerVisual...

  • .NET OpenCSV# Explorer - A Visual Studio 2005 add-in which interacts with Windows Explorer Visual Studio

  • Nice tool. Too bad it doesn't refresh the Recent Projects list after deletion.

  • Hi Songstre,

    Thanks for your comments!

    AFAIK, this can't be done from this tool simply because VS loads it from the registry while starting up. If I come to know of any API / Method which induces that call, I will update this tool.

    Rahul

  • Just don't run the tool on a fresh install of VS2008! It cores (object reference set to null...) because there is no list!

  • Rahul,

    A great tool - any chance you can modify it to work with VB Express 2008?

    Doug.

  • Doug Urquhart-Mitchell,

    Thanks.

    Stay tuned on www.dotnetscraps.com. I will post it once it is done. Can you mail me the registry key for Express edition. Instead of making it hardcoded, I will make it configurable.

    It should be something like...

    HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\ProjectMRUList

    Thanks,

    Rahul

    Mail me at rahulso@microsoft.com, and I will get it done whenever I get an opportunity.

  • "Feel free to download the code for this small utility..."

    Really, I do not know how to download the code...

  • Sorry about that as well as the late response JM!

    I removed the code by mistake. Right now, I don't have access to the FTP. If it is urgent, mail me and I will give a copy through email.

    Thanks,

    Rahul

  • Why don't you just post the code on Code Plex?

  • FYI: Used the ClearRecentList tool on VS 2008 Web Developer Express and got this exception:

    See the end of this message for details on invoking

    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************

    System.NullReferenceException: Object reference not set to an instance of an object.

      at ClearRecentItems.frmClearList.LoadItems()

      at ClearRecentItems.frmClearList.frmClearList_Load(Object sender, EventArgs e)

      at System.EventHandler.Invoke(Object sender, EventArgs e)

      at System.Windows.Forms.Form.OnLoad(EventArgs e)

      at System.Windows.Forms.Form.OnCreateControl()

      at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

      at System.Windows.Forms.Control.CreateControl()

      at System.Windows.Forms.Control.WmShowWindow(Message& m)

      at System.Windows.Forms.Control.WndProc(Message& m)

      at System.Windows.Forms.ScrollableControl.WndProc(Message& m)

      at System.Windows.Forms.ContainerControl.WndProc(Message& m)

      at System.Windows.Forms.Form.WmShowWindow(Message& m)

      at System.Windows.Forms.Form.WndProc(Message& m)

      at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

      at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

      at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    ----------------

    I'm clearing the registry list to clear the recently used:  [HKEY_CURRENT_USER\Software\Microsoft\VWDExpress\9.0\ProjectMRUList]

  • Here's source code for a similar, simplified (less elegant, but perfectly functional) utility that will clear the entire recent projects list with one button click.  To use this source code, in Visual Studio, create a new Windows Form project (VB), rename the form to "MainForm", adjust the form size and caption as you like, add a single button and name it "ClearBtn".  Add the line "Imports Microsoft.Win32" to the top of your form's code module (needed for registry access functions).  Create an event handler for the button's CLICK event, and update the click event handler's code to match what is shown below.  

    If you want to convert this to work with a different MS Visual Studio version or related Microsoft IDE, I would recommend doing a little research to find the registry subkey that said IDE uses and replace the registry string reference in the source code below with the corrected subkey (regKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\VisualStudio\9.0\ProjectMRUList", True))

    Like the earlier tool, this can be added as an external tool into Visual Studio, but it doesn't refresh the list that's already displayed, which is only requeried by Visual Studio when it's relaunched.  Maybe there's a way to do that.. you could also modify this application to clear the recent project list and then have it launch Visual Studio for you as a sort of "pre-loader" instead of using it as a tool from within Visual Studio, if you are really fastidious about keeping that list cleared.  I like to clear this list so I can make tutorial videos and not have a cluttered screen that references projects unrelated to the tutorial.

    Entire source code:

    '--FORM SOURCE BEGINS-------------------------------

    Imports Microsoft.Win32

    Public Class MainForm

       Private Sub ClearBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearBtn.Click

           Dim regKey As RegistryKey

           Dim str As String(), i As Integer, removed As Integer

           removed = 0

           Try

               regKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\VisualStudio\9.0\ProjectMRUList", True)

               str = regKey.GetValueNames()

               If str.GetLength(0) > 0 Then

                   For i = 0 To str.GetUpperBound(0)

                       If str.GetValue(i).ToString().Contains("File") Then

                           regKey.DeleteValue(str.GetValue(i).ToString())

                           removed = removed + 1

                       End If

                   Next

               End If

               regKey.Close()

           Catch ex As Exception

               ' Most likely cause of an exception is that the registry key/subkey specified does not exist

               MessageBox.Show(ex.Message())

           End Try

           If removed > 0 Then

               MessageBox.Show("Changes will be visible the next time Visual Studio 2008 is launched.", _

                               "Info", MessageBoxButtons.OK, MessageBoxIcon.Information)

           Else

               MessageBox.Show("Nothing to do.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information)

           End If

           Application.Exit()

       End Sub

    End Class

    '--FORM SOURCE ENDS---------------------------------

Page 1 of 2 (16 items) 12
Leave a Comment
  • Please add 2 and 6 and type the answer here:
  • Post