Answered Deploying WCF Services via TFS Build 2008

  • Monday, August 24, 2009 4:56 AM
     
     
    I'm trying to use TFS Build for continuous integration of WCF Services. Currently, all I need to do is to use the "Publish" feature in Visual Studio, and specify the target website. The target website has FrontPage extensions installed and configured.

    A TFS Build Server (Agent?) installation has also been completed on the dev integration box, which is the same box we need to deploy the WCF services. But even though the installation completed successfully, I was never prompted to specify the address of the main TFS server where the source code resides.

    I have a few basic questions:

    1. What is the role of the TFS Build Server (Agent?) ...? Does it need to be on every machine which we want to deploy our files to (Dev, UAT, Production)?

    2. Is it the case the the TFS Build components focus mainly on the "build" (compile) part of things and not the "publishing" (deployment) side?

    3. What needs to be done to achieve a smooth experience such as the "publish" feature of VS?

    4. My solution file contains several WCF Service projects, each of which may contain one or more .svc (and related .cs) files, as well as a web.config that is required. Does anything special need to be done to deploy such a scenario?

    Sorry for the newbie questions, but after searching for a while, I can only find people talking about some MSBuild scripting methods. I've not used MSBuild or any other automated build/publish/CI tool yet.

    Thanks
    Raza

Answers

  • Tuesday, August 25, 2009 5:38 AM
    Moderator
     
     Answered
    Hi Raza,

    1 The machine that TFSBuild service is running on is called "Build Agent" or "Build Machine". TFS server can call "TFSBuild service"  on "Build Agent" to build source code. You typically install "Team Foundation Build" on a computer that is dedicated to running builds.

    2 Because TFSBuildService use MSBuild to do build task or other tasks in fact, TFSBuild can do everything that MSBuild can do. MSBuild supports "Publish" a project, so TFSBuild supports "Publish" too.

    3,4  Because WebApplication is Unpublishable, VS only compile it can copy to publish url to "Publish" it.
           So we can make TFSBuild to do the same way.
           1) Add Web Deployment Projects for each WCF project
           2) Custom "AfterCompile" target in TFSBuild.proj to copy compiled webapplication to publish location

           In additional, MSBuild does not support UNC well, so it is needed to set publish location to location folder or shard folder, such as "C:\\publish\" or"\\buildagent\publish\" . And then you can set the Physical path of the IIS Site to the folder.

    If there is anything unclear, please feel free to tell me.

    Best Regards,

    Ruiz
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Sincerely, Ruiz Yi
    • Marked As Answer by Raza Ali Tuesday, August 25, 2009 8:45 AM
    •  

All Replies

  • Tuesday, August 25, 2009 5:38 AM
    Moderator
     
     Answered
    Hi Raza,

    1 The machine that TFSBuild service is running on is called "Build Agent" or "Build Machine". TFS server can call "TFSBuild service"  on "Build Agent" to build source code. You typically install "Team Foundation Build" on a computer that is dedicated to running builds.

    2 Because TFSBuildService use MSBuild to do build task or other tasks in fact, TFSBuild can do everything that MSBuild can do. MSBuild supports "Publish" a project, so TFSBuild supports "Publish" too.

    3,4  Because WebApplication is Unpublishable, VS only compile it can copy to publish url to "Publish" it.
           So we can make TFSBuild to do the same way.
           1) Add Web Deployment Projects for each WCF project
           2) Custom "AfterCompile" target in TFSBuild.proj to copy compiled webapplication to publish location

           In additional, MSBuild does not support UNC well, so it is needed to set publish location to location folder or shard folder, such as "C:\\publish\" or"\\buildagent\publish\" . And then you can set the Physical path of the IIS Site to the folder.

    If there is anything unclear, please feel free to tell me.

    Best Regards,

    Ruiz
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Sincerely, Ruiz Yi
    • Marked As Answer by Raza Ali Tuesday, August 25, 2009 8:45 AM
    •  
  • Tuesday, August 25, 2009 8:50 AM
     
     
    Thanks Ruiz Yi!

    So basically, the TFS Build service machine acts as a build computer from which it then pushes the compiled stuff to the target location.

    And for web, all we need to do is to push it to the right folder.

    So then there is no way to use the "Frontpage extensions" on the target machine the way VS 2008 uses it, right?

    Also, the web deployment projects usually create an msi file, even though for a wcf I only need to copy over the svc, config, dll and cs files. I'll try to configure the web deployment project to see if it can 'publish' without creating an msi file.

    Thanks again.

    Raza
  • Tuesday, August 25, 2009 9:05 AM
    Moderator
     
     
    Hi Raza,

    Though web deployment projects are usually used to do create a MSI file, but it can also help us compile web application, so we do not need to call "aspnet_compiler.exe" directly in TFSBuild.proj  to compile every web application.

    MSBuild has a "Copy" task used to copy files, this task does not support "Frontpage extensions", but you can write custom task to do this operation. And then MSBuild can call custom task to copy files to IIS Site.   Walkthrough: Customizing Team Foundation Build with a Custom Task

    Best Regards,

    Ruiz


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Sincerely, Ruiz Yi