none
Understanding the Difference Between TFS Builds and VS Builds

    Dotaz

  • I am trying to understand the differences between using Visual Studio to build a solution locally and how TFS builds the same solution.  I know that both processes use MSBuild to do the compilation but I have noticed some irreuglarities.  The build workflow builds each project in a solution.  Does VS do the same?

    I have been having some issues with project references.  It seems that multiple developers can get the latest code from TFS and build a branch locally but the same solution fails using TFS build and it appears to be a reference problem.  If anyone can shed some light on the actual differences, that would be great. 


    -7

    28. února 2012 20:16

Odpovědi

  • Hi Smyrin, 

    Thanks for your reply.

    TFS 2010 invoke MSBuild to build the solution by default, so please manually try to build your that project using MBuild on build agent machine, check can build your project correctly or not. If the MSBuild still tries to build all the project(vbproj) and fails, I suggest you invoke VS 2010 to build that project in build process template.

    Or you can contact MSBuild expert to ask how make MSBuild can build the project which updated from VB project to CS but not remove the .vbproj files.   


    John Qiao [MSFT]
    MSDN Community Support | Feedback to us

    2. března 2012 3:17
    Moderátor

Všechny reakce

  • smyrin,

    In short:
    - Visual Studio uses MSBuild to build your solution. It goes through all the project files, looks at the references tries to resolve them and build it.

    - TFS Build uses a Workflow on the build Controller and Build Agent to build the solution. It also uses eventually the MSBuild and goes through the project files (*.csproj). If you experience a difference in the build results then there is a difference in your local environment and then one on the build server.

    Maybe you are using references that do not exist in GAC or locally in the relative path of the solution.
    If you have the references in your solution pointing somewhere else in the Source Control then include that path also in your workspace mapping in the Build Definition.

    For the TFS Build references you can look at here:
    - Building the Application at MSDN


    Please remember to mark the replies as answers if they help. --- Success, Damir

    28. února 2012 20:43
  • Hi Smyrin,

     

    Thanks for your post.

     

    As we know that TFS 2010 invoke MSBuild to build solutions, so if we want to build solution/project using Team Build(default build process template), we should ensure the solution/project can be built using MSBuild first. If some projects can’t be built using MSBuild, for example, MSBuild not support to build Setup project, but the Setup project can be built using VS(devenv.exe), in this scenario, we need to invoke the VS in build process template to build the Setup project, please refer to Jakob’s blog here: http://geekswithblogs.net/jakob/archive/2010/05/14/building-visual-studio-setup-projects-with-tfs-2010-team-build.aspx. We can use the InvokeProcess activity in build process template to invoke other tools to build the project.

     

    To build solution using Team Build, we should ensure the following steps:

    1        The solution can be built completely on Build machine using VS.

    2        Ensure the your TFS Build Service account have the permission to build this solution on the Build machine.

    3        Ensure the solution can be built completely on Build machine using MS Build.

     

    Additionally, to build solution using Team Build, we need to ensure that on TFS Build machine, the Team Build Service can find the required dlls. We usually using the following two way to reference dlls when using Team Build:

          1 Create a Assemblies folder under Solution, and add all your dlls in this folder. After we check in the solution into TFS, the Team Build Service will get the solution from TFS to build on the Build machine, in this case, the Assemblies folder under solution will be get together. The structure like this:

                     TeamProject

                            /Solution1

                     /Assemblies

                     /Poject1

                     /Poject2

                     /…

                            /Solution2

                            …

            2 Create the same common folder on the Build machine as you created on your client, and the folder path is same. So when the Team Build to build the solution on build machine, it will try to find the dlls on the Build machine follow the relative path which your set in your project.




    John Qiao [MSFT]
    MSDN Community Support | Feedback to us


    29. února 2012 8:20
    Moderátor
  • I am familiar with TFS builds already as I have written a number build workflows that work great for our build environment.  However, every now an again, a developer makes a change to the code base and is able to build locally but TFS Build fails.  The most recent case, we updated a VB proj to CS but did not remove the .vbproj files just yet.  When we invoke VS to build the solution, it ignores the vbproj and builds the rest as expected.  When TFS builds the solution, it tries to build all the projects and fails when it hits the old vbproj file.  I am still puzzled by this behavior.

    -7

    2. března 2012 1:46
  • Hi Smyrin, 

    Thanks for your reply.

    TFS 2010 invoke MSBuild to build the solution by default, so please manually try to build your that project using MBuild on build agent machine, check can build your project correctly or not. If the MSBuild still tries to build all the project(vbproj) and fails, I suggest you invoke VS 2010 to build that project in build process template.

    Or you can contact MSBuild expert to ask how make MSBuild can build the project which updated from VB project to CS but not remove the .vbproj files.   


    John Qiao [MSFT]
    MSDN Community Support | Feedback to us

    2. března 2012 3:17
    Moderátor