Click here to Skip to main content
15,867,453 members
Articles / Desktop Programming / Windows Forms

Visual Studio Project MRU List Editor IV

,
Rate me:
Please Sign up or sign in to vote.
4.33/5 (3 votes)
9 Oct 2010CPOL3 min read 29.6K   566   18   7
An update the class core for editing Visual Studio's MRU list
Sin_t_tulo.png

Introduction

This little tool allows you to edit the "Recent Projects" list on the Visual Studio start page.

The project is based on earlier versions designed by peterchen, Josh Beach, Nelviticus.The code was made from zero but taking the concept of the above codes.

The reason for this update is to clarify, classify, and guide the application code written in the object-oriented programming.

I have simplified many parts of the code, such as the management of the MRU list. Now everything is contained in a class, and data collected from the Windows registry are standardized structures. This time around I'm manipulating, and I can retrieve the object.

There was not much to change, as there was a good work done by other programmers. I changed several things, among them, now if you try to explore a project that does not exist, this tells you to and do not open a folder by default

Using the code

To use this new class that I designed and can begin to manage the list of recent projects, we simply create a new instance of the class VS_MRU_Manager.

The class offers the following methods to manage lists:

Get_MRU_List:This method returns a list of objects of type List <structVS_MRU>

Get_VS_Versions: This method returns the list of versions of Visual Studio installed on this machine.

Delete_MRU_Project: This method eliminates the desired project from the list of recent projects.

Delete_All_MRU_Projects: This method eliminates all the projects on the list of recent projects.

Save_MRU_Project_List: This method saves and rearranges the windows registry KeyName the list of projects specified in the parameters of the function.

Delete_Orphan_MRU_Projects: This method removes all orphaned projects on the list of recent projects.

Standard structures for information management within the program:

public struct structVS_Version
{
    public string Name; //Contains the name of the version.
    public string Version; //Version identifier.
    public string Year; //Year of the version.
    public string RegKeyLocation; //Version path in the Windows registry.
}
public struct structVS_MRU
{
    public string ProjectName;
    public string ProjectPath;
}

History

June 5, 2008 - peterchen

  • Fixed: Save failed when Visual Studio 2008 was not installed
  • Added: Additional keyboard support
    Shift+Up/Down to move an item, Del to remove, Num-+ to add an existing project/solution
  • Changed selection change after Delete to match my personal preferences

Oct 29, 2009 - Nelviticus

  • Changed: Uses ListView instead of ListBox for better display of file name and directory - much easier to read
  • Added: Now supports Visual Studio 2010. You can add support for other versions by editing the config file in your installation directory (if using the installer) or editing the project settings (if building the project yourself). No need to add a new AddVersion() call and re-build the application

April 22, 2010 - Nelviticus

  • Fixed: Browsing to Visual Studio 2010 projects by double-clicking entries or clicking the 'Explorer' button now works. VS2010 uses environment variables in the file paths it stores in the registry, but because the Process.Start method doesn't expand these, we have to do it manually.

October 2, 2010 - Alberto Molero

  • Can't add project files that already on the list.
  • Automatic update MRU project list when you delete the project, adding a new project to the list, and remove orphaned projects.
  • A specific class to manage everything related to the lists of recent projects.
  • Standardization of information extracted from the Windows registry by using structures.

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

Written By
Software Developer
Spain Spain
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
BugWiped out nearly all MRU entries and seized Pin
fwcetus4-Oct-13 11:55
fwcetus4-Oct-13 11:55 
GeneralRe: Wiped out nearly all MRU entries and seized Pin
Alberto M.5-Oct-13 21:48
Alberto M.5-Oct-13 21:48 
GeneralRe: Wiped out nearly all MRU entries and seized Pin
Alberto M.6-Oct-13 1:18
Alberto M.6-Oct-13 1:18 
GeneralA bug work with visual studio 2010 Pin
shijiyong8-Oct-10 6:33
shijiyong8-Oct-10 6:33 
GeneralRe: A bug work with visual studio 2010 Pin
Alberto M.9-Oct-10 10:35
Alberto M.9-Oct-10 10:35 
GeneralA few suggestions Pin
Nelviticus5-Oct-10 4:41
Nelviticus5-Oct-10 4:41 
Hi Alberto,

I've only had a quick look so far but it looks good. I have a few suggestions though.

Looking at your VS_MRU_Manager class, if you add a constructor to your structVS_Version struct like this:
public structVS_Version(string name, string version, string year, string regKeyLocation)
{
    Name = name;
    Version = version;
    Year = year;
    RegKeyLocation = regKeyLocation;
}

then you can save a lot of typing in your class constructor with lines like these:
Versiones_Visual_Studio.Add(new structVS_Version(
    "Visual Studio",
    @"Software\Microsoft\VisualStudio\10.0\ProjectMRUList",
    "10.0",
    "2010"));

Also, if you look at the version I wrote it gets all its Studio version settings from the config file in the application directory. This way you don't have to re-build the application when Microsoft bring out a new version of Studio, you can just edit the config file.

Finally, your method Get_MRU_List fails for Visual Studio 2010 for two reasons: firstly, the MRU entries for 2010 use environment variables in the path and secondly some entries have pipes and extra characters at the end. An example MRU entry from my PC:
%UserProfile%\my documents\visual studio 2010\Projects\OfficeTest\OfficeTest.sln||False
You need to replace this line:
tmpMRU.ProjectName = Path.GetFileName(tmpProjectPath);
with these:
if (tmpProjectPath.Contains("|"))
    tmpProjectPath = tmpProjectPath.Remove(tmpProjectPath.IndexOf("|"));
tmpMRU.ProjectName = Path.GetFileName(Environment.ExpandEnvironmentVariables(tmpProjectPath));
You'll also need to change the btnExploreProject_Click method to handle these entries.
Regards

Nelviticus

GeneralRe: A few suggestions Pin
Alberto M.6-Oct-10 2:21
Alberto M.6-Oct-10 2:21 

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.