Contents tagged with Visual Studio

  • integrating external systems with TFS

    Recently, we need to integrate external systems with TFS. TFS is a feature-rich system and has a large API. The TFS sample on MSDN only scratch the top surface. Fortunately, a couple of good blog posts get me on the write direction:

    The key is to use the VersionControlService. We need to reference the following assemblies:

    Microsoft.TeamFoundation.Client.dll

    Microsoft.TeamFoundation.Common.dll

    Microsoft.TeamFoundation.VersionControl.Client.dll

    Microsoft.TeamFoundation.VersionControl.Common.dll

    The code would be something like:

    using Microsoft.TeamFoundation.Client;
    using Microsoft.TeamFoundation.Framework.Common;
    using Microsoft.TeamFoundation.Framework.Client;
    using Microsoft.TeamFoundation.VersionControl.Client;
    
    ...
    
    TfsTeamProjectCollection pc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(tfsUri);
    VersionControlServer vcs = pc.GetService();
    

    Then to check whether a file exists, we can use:

    vcs.ServerItemExists(myPath, ItemType.File)

    Or check if a directory exists:

    vcs.ServerItemExists(myPath, ItemType.Folder)

    To get a list of directories or files, we can use the GetItems method. TFS is far more complicated than a file system. We can get a file, get the history of a file, get a changeset, etc. Therefore, the GetItems method has many overloads. To get a list files, we can use:

    var fileSet = vcs.GetItems(myPath, VersionSpec.Latest, RecursionType.OneLevel, DeletedState.NonDeleted, ItemType.File);
    foreach (Item f in fileSet.Items)
    {
        Console.WriteLine(f.ServerItem);
    }

    Or get a list of directories:

    var dirSet = vcs.GetItems(myPath, VersionSpec.Latest, RecursionType.OneLevel, DeletedState.NonDeleted, ItemType.Folder);
    foreach (Item d in dirSet.Items)
    {
        Console.WriteLine(d.ServerItem);
    }
  • Is it time for cloud-based ASP.NET IDE? (round 2)

    8 months ago, I asked whether it is time for cloud-based ASP.NET IDE. I have long been dreaming of being able to create web application on the spot while talking to users. I was able to do that 20 years ago with VB3. Today, the closest thing I can do with web application is with a CMS like Orchard. To work on a live website, we need an editor that is accessing the live site. We also need a tool to indicate the link between the html in the browser and the code that generate the html.

    A lot has happened in the past 8 months. For the cloud based editor, first I saw Scott Hanselman’s blog about Microsoft’s own cloud editor. Then we found this editor to appear in Visual Studio Online.

    For the tools that link html with source code, I first saw the very impressive shape tracing tool in Orchard. Then we saw the browser link and remote debugging feature in Visual Studio 2013.

    So whether the IDE itself is in the cloud or not, the new VS2013 features together with the Azure feature of deploying directly from a repository brings up ever close to being able to work on a live web application in front of a customer.

  • Experimenting with Visual Studio 11 Beta

    Windows 8 is coming soon. You need Visual Studio 11 beta to develop Windows 8 applications. That said, Visual Studio 11 also offers many new features even if you do not specifically program for Windows 8:

    • .NET Framework 4.5
    • ASP.NET 4.5
    • ASP.NET MVC 4

    What is the best way to start experimenting with Visual Studio 11 Beta? .Net Framework 4.5 is a highly compatible in-place update of .Net Framework 4.0. If you uninstall .Net Framework 4.5 beta, you will have to reinstall .Net Framework 4.0. For this reason, I would suggest you not to experiment with Visual Studio 11 beta on your main work machine. Fortunately, there is a way that allows you to experiment with Visual Studio 11 with satisfactory performance without a spare machine.

    If your operating system is Windows 7, you can dual-boot your machine off a VHD. You secondary OS will resides in a VHD so it will not mess up your primary OS, yet your machine will boot from the VHD natively so the performance is much better than running a virtual machine. In my case, I installed a copy of Windows 8 consumer preview on VHD by following this blog. I then install Visual Studio 11 Beta on top of it. I then get a Windows 8 Preview/Visual Studio 11 Beta combo that I can experiment with. The performance is only slightly (let’s say 10%) worse than a dedicated machine. I can still access the files in my native file system. Is there inconvenience in dual boot? The inconvenience can be managed if you rearrange your data to live in the cloud.