So when I’m asked, “How can I integrate my PHP IDE with Team Foundation Server?”, my first response *should* be, “Why not use Visual Studio instead?” That’s an idealistic reply, admittedly. There are several great tools out there for PHP development, with followings that would collectively shudder at the thought of *having* to use Visual Studio.
PhpED by NuSphere is a popular PHP development tool. It boasts (among a lot of other things) the ability to plug-in to various version control systems, although it comes set up to leverage CVS. There’s not much documentation out there to explain how exactly to tie into other version control systems besides CVS. So what about Team Foundation Server?
The fast answer? Use the TFS Power Tools, more specifically the Windows Explorer extension. This power tool allows you to perform version control operations on files directly from Windows Explorer:
All that’s really required (besides having the TFS Power Tools installed) is that the files you want to work on reside in a folder that’s in a TFS workspace.
If you use PhpED for PHP development, you probably see where I’m going with this. ;)
Let’s say I have the below workspace and project in PhpED:
I set up this project in C:\Work\NotDotNet\Test, which is already mapped to a TFS workspace. As soon as I start populating files into this project, I can see that the Windows Explorer extension power tool is already working if I look at the file system:
Now for the fun part. PhpED has a nifty little feature that allows you to access the Windows shell from within its IDE. Right-click, select “Shell Menu”, and there it is!
To add all these files to TFS version control, I right-click the project and select Shell Menu->Team Foundation Server->Add.
The “Add to Source Control” dialog pops up:
Hit “Finish”, and I’ve added all my files as pending changes to TFS. Last, all I have to do is check them in by again going to the Shell Menu, only this time selecting “Check In”.
That gives me the TFS check-in dialog we all know and love. I can do everything I normally would with this dialog, such as choosing specific files to check in, comments, check-in notes, and linking to work items.
Click “Check In” and I’m done (in my case, check check-in created changeset 270)!
BTW, notice I’m getting the TFS version control icons displayed in PhpED (the green triangles in at the bottom-right of an item’s icon indicates it’s “seen” by TFS, a pencil indicates a checked-out file, etc.):
Now to test that I can check out and check in, let’s make a little change. (My big preface here is that I know almost nothing about PHP development, so I’m just going to insert some arbitrary text so I have a modification. This is not a PHP lesson!)
First, I noticed that PhpED won’t even let me modify a file (may be a setting somewhere, but I’m not sure) if it’s read-only. So that tells me right away that my file is not checked out.
So I check out the file via the Shell Menu extension (Shell Menu->Team Foundation Server->Check Out for Edit).
Now I can make a small change.
Once I’m done making my edits, I save the file and check it in (again using the Shell Menu, you probably get this by now).
Again, I get the beloved check-in dialog again.
Fill in the information I want, click “Check In”, and I’m off!
Now, just to make sure I’m not looking at smoke and mirrors, let’s switch to Team Explorer and view the file’s history.
There’s my change! Now, for a final check, let me diff the two versions.
Make sense? Not bad for a free integration point!
Now, this all said, there is one main caveat which is worth mentioning – it shouldn’t prevent you from leveraging this shell-type integration, but it should be known nonetheless. The TFS Power Tool shell extension only provides the basic version control operations. Others, such as getting historical versions, viewing history, branching, merging, and shelving are notably absent from the shell extension’s menu. You can still do all this from Team Explorer – you’ll have this installed on your machine, as it’s a requirement for the TFS Power Tools to be installed. So yes, for some operations you’ll need to pop open Team Explorer, but the bulk of your daily operations are available right from the shell.
BUT, PhpED is also has a very extensible menu system (that’s how it ties in with CVS), so you may also be able to leverage that to create TFS-specific menu options (such as creating workspaces, diffing files, etc.). I had a little fun with this and was able to quite easily create a couple of TFS-related menu options to help me view a file’s history, as well as create a shelf. All I did was drop the path to tf.exe (by default it’s "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\”) into my PATH environment variable (just easier than putting in the full path to tf.exe each time), and away I went.
In PhpED, go to Tools->Settings, then scroll down to Integration under Tools. Here I created a new menu called “Team Foundation Server” and added a few submenu items with the following options (I’m sure you can figure out how to add a few more if you want):
And I end up with this:
As you can see, I can leverage the command-line interface for both Team Explorer (tf.exe) and the Power Tools (tfpt.exe, which gets added to your PATH automatically upon installation).
So now, when I right-click on certain objects in PhpED, I can take advantage of these options. They simply shell out the specified commands and the appropriate CLI takes over. For example, if I select “View History”,
I get this:
So that’s about it! There of course may be other ways to integrate these two products (perhaps using SVNBridge on CodePlex), but I found this above method to be quick and relatively painless.
I hope this helps a couple people! Please let me know what you think, or if you have any questions.
I’ll be speaking about “Team Foundation Server: Today & Tomorrow” at the August meeting of the South Colorado .NET User Group. I hope to see you there!
Last week, we expanded availability for Expression Studio to all MSDN Premium subscribers with the release of Expression 3 on MSDN Subscriber Downloads. Previously, only subscribers at the Visual Studio Team System Team Suite with MSDN Premium level have been able to download Expression Studio, while all other MSDN Premium subscribers (e.g., Visual Studio Professional with MSDN Premium, Visual Studio Team System Development Edition with MSDN Premium, etc.) only had access to Expression Web and Expression Blend.
Download Expression Studio 3 here (from MSDN, for MSDN Premium subscribers)!
On August 6th, the first public release of Windows 7 will be to MSDN Subscribers, which is over two months ahead of the general availability date of October 22nd for retail and OEM customers! Lucky you!
To support the variety of languages and builds, 893 different images are being released to MSDN Subscriber Downloads in three waves through August 21st:
Below are a few resources you may find helpful: