Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create Explorer Shortcuts to specific TFS 2010 Source Control Paths

We are slowly moving projects from old file based storage (don't ask) to tfs. Our coders are still used to find the code in the file System.

Since we are talking about 100 Projects each with some sort of history, we have to move them carefully one by one. Resulting that we will have to live for some time with the already existing file structure mixed with the TFS managed files.

To make life easier for our coders, I would like to create a shortcut in the filesystem, for each project that we moved. So the developers can look up if the Project has already been moved, and if yes, go by double click to open up the TFS Source Control Explorer pointing directly to the correct Project.

Is this possible? Thanks for your Response.

like image 903
Marwie Avatar asked Jul 19 '13 16:07

Marwie


1 Answers

I found a simple solution for my needs, which is based on a small batch script, that you'll have to click. It's not a shortcut so to say even though you can still create a shortcut of the batchfile.

Here's the script:

CALL "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" x86
REG ADD "HKCU\Software\Microsoft\VisualStudio\10.0\TeamFoundation\SourceControl\Explorer\<GUIDofTFS>" /v "SceMostRecentPath" /d "$/<PathToTfsProject>" /f
devenv /Command View.TfsSourceControlExplorer

In fact I combined 2 ideas found in separate sources:

1. Start VS with Source Control Explorer

2. Manipulate Registry to open Source Control Explorer in a specific path

With the command devenv /Command View.TfsSourceControlExplorer you can actually start VS and automatically open Source Control Explorer. Unfortunately there is no way to give a parameter to point it directly to a location you wish. But I noticed that VS2010 seems to persist the last used path and reopens to that place on restarts. A quick research resulted in the registry entry

HKCU\Software\Microsoft\VisualStudio\10.0\TeamFoundation\SourceControl\Explorer\058104ed-f0e2-4126-9ccc-0e37e19c4f91\SceMostRecentPath

By manipulating the value of SceMostRecentPath you can trick VS2010 to open Source Control Explorer with the path in there. Keep in mind: You will need to replace 058104ed-f0e2-4126-9ccc-0e37e19c4f91 with the GUID of your TFS Installation.


Since we are all using VS 2010 but the installation paths differ, I implemented the path dynamically by making use of the VS100COMNTOOLS variable. First we set up the TFS command line environment:

CALL "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" x86`

Then we change the registry:

REG ADD "HKCU\Software\Microsoft\VisualStudio\10.0\TeamFoundation\SourceControl\Explorer\[PutYourTfsGUIDHere]" /v "SceMostRecentPath" /d "$/<YourTfsPath>" /f

Finally we do a simple call of devenv.exe with the source Explorer command:

devenv /Command View.TfsSourceControlExplorer
like image 85
Marwie Avatar answered Sep 28 '22 00:09

Marwie