Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Visual Studio Project MRU List Editor II

0.00/5 (No votes)
6 Jun 2008 1  
Improving Josh Beach's Visual Studio Project List editor

Note: For Visual Studio 2008 support and other improvements, please see this update by nelveticus.

Screenshot - vsProjectListEditor.png

Overview

Josh Beach has written a nice little tool to manage the "Recent projects" list in Visual Studio. It allows to edit the "recent projects" list for the start page of Visual Studio. I added the following features:

  • Select the Visual Studio version you work with (see the drop down list above)
  • "Kill Zombies" - removes all entries that don't exist anymore on disk
  • "Kill Zombies & Projects" - remove all files that don't exist on disk, and everything that doesn't end in ".sln"
  • "Explore", browsing to the current selection in explorer
  • Changed the save handling to work together with version switching

I wanted to submit this as an update to Josh's article, but unfortunately he doesn't seem to be active on this site anymore.

The Code

Don't look at it, the stuff I added is horrible. :)

This is a straightforward C# WinForms application, with all the logic in the Forms class. The list of projects is read from the registry, you can change the position in the list and add and remove items, and write back to the registry (all Josh's code). The dropdown selects the registry from which the information is read and can easily be configured.

TaggedString

The only class that might be of slight interest on an otherwise boring Sunday afternoon is TaggedString which provides the Text/Tag separation for ListBox and ComboBox items, too.

The good citizen rule for feeding UI controls is to keep representation separate from the data. WinForms offers in most places a Tag member where the caller can attach a reference to the actual data.

Unlike most WinForms controls, the ListBox and ComboBox don't offer a separate Tag for its items. Rather, it accepts a collection of objects, and displays the result of ToString() as item text. (This looks like sloppiness to me, but who knows?)

TaggedString associates a string (to be displayed) with a Tag (the object associated with the listbox / combobox item) like so:

   public class TaggedString<T>
   {
      string m_title;
      T m_tag;

      public TaggedString(string title, T tag)
      {
         m_title = title;
         m_tag = tag;
      }

      public override string ToString() { return m_title; }

      public T Tag { get { return m_tag; } }
   }

The Project List Editor stores the registry path in the tag, so it's using a TaggedString<string> like this:

  cbDevStudioVersion.Items.Add(
       new PH.Util.TaggedString<string>(
         "2005", // the string to display
         @"Software\Microsoft\VisualStudio\8.0\ProjectMRUList")); // the associated data

This is by far the shortest time I spent on an article - I hope you like it anyway.

License

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