Check out TFS files directly from SQL Server Management Studio

The other day I explained how to configure the external tools feature of Edit Pad Pro to allow direct checking out of files from TFS.

Today I did the same thing in SQL Server Management Studio.

Configuring TFS Checkout in SQL Server Management Studio

Here are pictorial instructions:

Command: we are using the environment variable created by VS2012 to provide a generic path to the TF.exe command line tool. If you are not using VS2012, open a command prompt, type "set" and see which path is closest. Alternatively, just put in the absolute path to tf.exe.

If you do not have Visual Studio at all you can install the standalone Team Explorer for Visual Studio 2012 which includes tf.exe.

Arguments: we are passing the "checkout" command to tf.exe with a parameter of the full path to the .sql file we are working on.

Use Output window: this is optional but it will show you the information returned by the tf.exe command line tool.

Using the External Tool

This is simple. The tool item you just created now shows up in the Tools menu. Just click it and it will checkout the current file you have open in the IDE.

Last Words

There is a small annoyance: SSMS will try to save all unsaved files before running the external tool. In this case, if we've modified the file then it will try and save over a Read-only file, causing it to try and Save As to a new file name.

I believe this is a bug in SSMS, or a well-intentioned, yet obstructive feature. I can't see a way to disable this behaviour. Just press Escape to avoid this - the external tool will then run.

Let me know in the comments if you need any more information!

How to automate TFS checkouts from EditPad Pro

I am a long time user of the great EditPad Pro from JGsoft. I use it for text file manipulation and basic programming. I starting using it when it was at version 3 or 4; purchased it at version 5, and even upgraded my licence to 6 and 7!

You may find Text Editors boring - understandable! They are one of those types of software that is not particularly exciting, but for certain people, they are an essential tool. And if they perform slowly or lack intricate features, they will be quickly superseded by something better.

Developers need a powerful text editor. End of story.

As a developer you have to deal with a multitude of file types - config files, data import/export files, source code, database queries, and so on. Often you need to quickly search files, or change their contents and produce a new file.

EditPad Pro is an awesome tool for getting in there and quickly doing what you need. As I mentioned, I've used it for many years

It's an indispensable tool for me. This is due to features such as:

  • Customisable syntax highlighting for a very wide range of file types, e.g. sql, vbs, sh, XML
  • Powerful regular expression search and replace (actually I also bought RegexBuddy from JGsoft to make constructing these easier)
  • Stable handling of very large text files
  • Fast operation - fast to load, never laggy
  • External tool support - which is the point of this post!

Integrating TFS checkout into EditPad Pro

In my current job, we use Team Foundation Server for source control. Visual Studio 2010 has great integration, in that it automatically checks out files when you try to edit them. 

However, we also store various other file types in TFS, which we do not edit in Visual Studio. Personally, I use EditPad Pro (EPP) to edit these. I have been manually checking out the files when I need to edit them using the Shell Integration provided by the TFS Power Tools. This works fine, but becomes tedious. 

Then I remembered that I could integrate the TFS command line application into EPP!

The screenshots below will show you how to do it, but in brief:
  1. Open a file from your TFS working copy, that is currently checked in (Read Only)
  2. Click on the Tools menu, then Configure Tools...
  3. Configure the command line and add a keyboard shortcut. If you want it in the toolbar, you can check 'Show caption on toolbar'
  4. Close the Tools dialogue and press your keyboard shortcut.
  5. Your file is now checked out!
Now a bit more detail...

Tool Definition

This is where you set up the command line to run, and add the placeholders which pass the information from EPP to the command line tool.

In this case it is very simple:

"C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\TF.exe" checkout "%FILE%"

Your path to TF.exe may differ - just search your C drive.

The important part to note is you need the "" around the %FILE% placeholder to ensure that if you have spaces in the path to the file, this will be handled correctly.

TF.exe does not require the working folder to be set.

Tool Definition - set up the command line here

Files dialog

You don't really need to set anything up here, but if you like, you can check 'Reload the current file'. This ensures the latest version checked out from TFS will be displayed. EPP should automatically reload the file anyway though, so it's not strictly required. (You can set this behaviour in the main Preferences dialogue, under Open Files: check 'Automatically reload the active file if it was modified on disk.')

This section may be more useful to you if you want to do something like save your local copy in another temp file before you check out. You could tick the second option to do this.

If you are setting up a TFS check-in task, then you would check the first option to make sure the file is saved before checking in.

Tool file actions - optional

Standard I/O Dialogue

This is useful in case we get any errors. In this case, I set up the standard error to redirect to the message panel. This means you will see any errors if they occur (e.g. TFS down)

You can also set this to save the standard output to the message panel or to a new file. We don't need it in this case, because the standard output just tells us the file was checked out!

These settings are most used for tools which take your file's contents, change them, and produce modified output. With these tools, it's ideal to set the standard output to capture to a new tab. I have done this when using perl scripts to format files, etc.

Standard I/O - where to send the command line output

So there you go - look how easy it is to integrate an external tool into your text editor - and save yourself a lot of tedious clicks AND time!

If you are interested in trying out EditPad Pro - it's your lucky day! You can get a 30 day trial of EPP right here. Once the trial ends, it just switches to the Lite version, so you can keep using it forever.

Tags

windows (10) microsoft (9) .net (6) google chrome (5) windows 7 (5) asp.net (4) google (4) google browser (4) development (3) javascript (3) mssql (3) rss (3) sql server (3) wordpress (3) automation (2) blogging (2) css (2) database (2) firefox (2) get all wordpress images (2) gmail (2) google docs (2) intel (2) internet explorer (2) linux (2) linux commands (2) microsoft word (2) mysql (2) netsh (2) network issue (2) proxy (2) seo tips (2) shell (2) sun (2) tfs (2) videos (2) wget (2) windows networking (2) windows vista (2) winhttp (2) .net 3.5 (1) .net 4.5 (1) .net async ctp3 (1) .net framework 4.0 (1) 404 (1) JungleDisk (1) access (1) active directory (1) addons (1) adobe acrobat (1) adobe dlm (1) adobe reader (1) adp (1) adsense (1) adtoll (1) adwords (1) amazon (1) antivirus (1) asp.net 4.0 (1) authentication (1) back links (1) backlinks (1) bacula (1) bash (1) batch files (1) blogger (1) box (1) browser exploits (1) category rss (1) cell phone (1) cell phone comparison (1) charting (1) cheap cell phones (1) cheap laptop upgrades (1) checkout (1) chrome (1) chrome.manifest (1) cloud (1) cloud hosting (1) cloud vps (1) code (1) color chart (1) colour chart (1) conditional formatting (1) config (1) configuration (1) context menu (1) copy (1) corrupt (1) credentials (1) cross-reference (1) database scripts (1) dba scripts (1) debian (1) decrypt (1) delete file windows vista (1) delete files (1) dell (1) dell laptop (1) dell studio (1) dell studio 1537 (1) dhcp (1) directory size (1) div (1) dns (1) document properties (1) dotnet (1) download (1) dreamhost (1) dreamhost coupon (1) dreamhost promo (1) dreamhost promo code (1) drive letter (1) drivers (1) duplicate content (1) editpad pro (1) encrypt (1) encryption (1) error (1) error code (1) excel (1) exception (1) external hard drive (1) facebook (1) faviconize (1) feeds (1) firefox 3 rc1 (1) firefox 3.1 (1) firefox addons (1) firefox tabs (1) firewall (1) firewall script (1) fix (1) fix .net framework (1) foreign keys (1) gmail 2.0 (1) gmail error (1) google chrome 2.0 (1) google chrome dev (1) google chrome exploit (1) google reader (1) google reader tags (1) gtdinbox (1) hard drive (1) hex color (1) hex colour (1) htaccess (1) html (1) html 5 (1) iis6 (1) installation (1) ipod touch (1) ipod touch 2g (1) ipod touch freeze (1) ipod touch magnet case (1) ipod touch magnet case problem (1) ipod touch problem (1) iterator pattern (1) itunes (1) java (1) joomla (1) jquery (1) laptop (1) laptop upgrade (1) laptops (1) latex (1) leeching (1) like button (1) link checker (1) linkbacks (1) linq (1) linqdatasource (1) lost password (1) making money online (1) map drive (1) mega cheap phones (1) microsoft excel (1) microsoft signature (1) microsoft store (1) microsoft web deploy (1) microsoft windows (1) microsoft word 2007 (1) minimize firefox tabs (1) mozy (1) ms word (1) msdeploy (1) msdtc (1) nant (1) netstumbler (1) network path not found (1) network path was not found (1) network problem (1) networking (1) new movies (1) nintendo (1) nirsoft (1) nocheckbrowser (1) number (1) odf (1) odt (1) online backups (1) open source browser (1) openoffice (1) oracle (1) oracle client (1) photoshop (1) phpmyadmin (1) podcast (1) powershell (1) pr checker (1) productivity (1) proxy server (1) proxycfg (1) putty (1) recover (1) registry (1) reinstall windows 7 (1) remote desktop (1) remove (1) repair (1) reset joomla admin password (1) rewrite (1) rsa (1) sandy bridge laptop (1) seagate momentus xt (1) seo tools (1) sequence (1) server monitoring (1) sftp (1) social networks (1) softlayer (1) soulseek (1) spreadsheet (1) spreadsheet formula (1) sql (1) sql scripts (1) sql server management studio (1) sqlclient (1) ssh (1) ssis (1) ssl (1) ssms (1) subst (1) tabmixplus (1) telstra (1) text editor (1) trust (1) unlock cell phone (1) unlock mobile phone (1) upgrade laptop hard drive (1) user management (1) vb.net (1) video download (1) virtual server (1) visual studio (1) vodafone (1) vodafone australia (1) vps (1) vps.net (1) wd external drive (1) web deploy (1) web dev (1) web development (1) web hosting (1) web security (1) webdev (1) webmail (1) webmaster tips (1) western digital (1) wifi networks (1) wii (1) win7 (1) windows 7 backup (1) windows 7 gadgets (1) windows 8 (1) windows 8 antivirus (1) windows error (1) windows live (1) windows live essentials (1) windows live toolbar (1) windows tips (1) windows web development (1) windows xp (1) winxp (1) wireless networks (1) word tips (1) wordpress 2.7 (1) wordpress plugin (1) wp super cache (1) yield (1) youtube download (1) youtube playlist download (1)