Click here to Skip to main content
15,867,488 members
Articles / Programming Languages / C#
Article

Visual Studio Project MRU List Editor II

Rate me:
Please Sign up or sign in to vote.
4.81/5 (13 votes)
6 Jun 2008CPOL2 min read 50K   526   20   15
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:

C#
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:

C#
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Klippel
Germany Germany
Peter is tired of being called "Mr. Chen", even so certain individuals insist on it. No, he's not chinese.

Peter has seen lots of boxes you youngsters wouldn't even accept as calculators. He is proud of having visited the insides of a 16 Bit Machine.

In his spare time he ponders new ways of turning groceries into biohazards, or tries to coax South American officials to add some stamps to his passport.

Beyond these trivialities Peter works for Klippel[^], a small german company that wants to make mankind happier by selling them novel loudspeaker measurement equipment.


Where are you from?[^]



Please, if you are using one of my articles for anything, just leave me a comment. Seeing that this stuff is actually useful to someone is what keeps me posting and updating them.
Should you happen to not like it, tell me, too

Comments and Discussions

 
GeneralNew version Pin
Nelviticus8-May-08 0:31
Nelviticus8-May-08 0:31 
GeneralRe: New version Pin
peterchen8-May-08 20:31
peterchen8-May-08 20:31 
GeneralRe: New version Pin
Nelviticus8-May-08 22:09
Nelviticus8-May-08 22:09 
GeneralVS 2008 support and ToolTips [modified] Pin
Nelviticus26-Feb-08 23:35
Nelviticus26-Feb-08 23:35 
GeneralRe: VS 2008 support and ToolTips Pin
Dennis Micheelsen7-May-08 22:59
Dennis Micheelsen7-May-08 22:59 
GeneralC# 2005 Express support Pin
peterchen4-Jan-08 3:32
peterchen4-Jan-08 3:32 
GeneralGood one Pin
Mushtaque Nizamani18-Aug-07 3:30
Mushtaque Nizamani18-Aug-07 3:30 
GeneralVS Add-in Pin
filipk22-Apr-07 12:32
filipk22-Apr-07 12:32 
GeneralRe: VS Add-in Pin
peterchen22-Apr-07 22:55
peterchen22-Apr-07 22:55 
GeneralOnly show solutions Pin
Marc Clifton20-Apr-07 2:30
mvaMarc Clifton20-Apr-07 2:30 
GeneralRe: Only show solutions Pin
peterchen20-Apr-07 5:07
peterchen20-Apr-07 5:07 
GeneralRe: Only show solutions Pin
Marc Clifton20-Apr-07 5:10
mvaMarc Clifton20-Apr-07 5:10 
GeneralRe: Only show solutions Pin
peterchen20-Apr-07 11:45
peterchen20-Apr-07 11:45 
GeneralRe: Only show solutions Pin
Axel Rietschin20-Apr-07 6:16
professionalAxel Rietschin20-Apr-07 6:16 
GeneralRe: Only show solutions Pin
peterchen21-Apr-07 3:15
peterchen21-Apr-07 3:15 

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.