SFTP Access with SharpSSH

A project that I was working on required the use of SFTP to transfer some files. I was surprised to find that there seemed to be no support for this anywhere in the .net Framework. After Googling around for a bit, I found a nice open source project called SharpSSH.

SharpSSH was surprisingly easy to use and worked great! I was able to SFTP a file in 4 lines of code:

SshTransferProtocolBase sshCp = new Sftp("", "ftp", "ftp123");
sshCp.Put("c:\\testdoc.txt", "test123.txt");

This was exactly what I was looking for: a simple, lightweight SFTP library. I added some exception handling and logging, removed my hard-coded values with user-defined settings, and called it a day!


freeSSHd (a free SFTP server)


Link TFS Work Items Programmatically

One of the things that’s bothered me with TFS is the need to manually link Sprint Backlog Items to Product Backlog Items. During sprint planning meetings, we use Excel to quickly create lots of sprint backlog items for everybody on the team, but then we need to go through and manually create links to related product backlog items that we use for release planning and release progress tracking.

I decided to do a little research and found that TFS work items can be linked programmatically by utilizing the Visual Studio SDK’s TeamFoundation libraries. I use a TFPT command-line wiql query to find potential link candidates, then parse work item titles for a common number than can be used to find related work items. I do another wiql query to search for the work item ID of the related product backlog item. If found, I attempt to create a link between the two work items.

Here’s the relevant code:

TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer("mytfs");
WorkItemStore store = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
WorkItem sbiWorkItem = store.GetWorkItem(sbiId);
    sbiWorkItem.Links.Add(new RelatedLink(pbiId));
    Console.WriteLine(string.Format("Linked SBI {0} to PBI {1}", sbiId, pbiId));
catch (Exception ex)
    // ignore "duplicate link" errors
    if (!ex.Message.StartsWith("TF26181"))
        Console.WriteLine("ex: " + ex.Message);

Visual Studio 2008 SDK v1.1