Building VisualGDB Makefile projects with Team Foundation Server

This tutorial shows how to build non-MSBuild VisualGDB projects using Team Foundation Server. In this mode you don’t need a separate Visual Studio installation on your build server (although you still need a separate license of VisualGDB if you want to make use of the VisualGDB logic for uploading sources, synchronizing settings and running custom actions).

If you haven’t configured TFS yet, we recommend following our basic TFS integration tutorial first. In this tutorial we will use 2 machines: server that will run the TFS build agent and client that will be used for editing the projects in Visual Studio.

  1. Install TFS on the server and configure the build agent. Copy the contents of the C:\Program Files (x86)\Sysprogs\VisualGDB folder on the client to an arbitrary location on the server. Then run VisualGDB.exe /about to enter your license details or VisualGDB.exe /intro to start a trial on the build server:01-aboutNote that using VisualGDB with TFS requires version 5.3R3 or later.
  2. Set the VISUALGDB_DIR environment variable to point to the VisualGDB directory and run the build agent on the server: 02-runIf you are running the build agent as a service, ensure that the VISUALGDB_DIR variable is set globally on the machine where the agent runs.
  3. On the client begin creating a new VisualGDB project inside your TFS checkout directory (see this tutorial for details on setting up a TFS project and creating a local checkout):03-newprjThe techniques shown in this tutorial will work for different project types, however we will use a basic Linux project do demonstrate it.
  4. On the first page of the wizard select “Create a new project” and then pick a build system other than MSBuild. Using TFS with MSBuild would require installing Visual Studio on the build server and is described in the TFS MSBuild tutorial while this tutorial focuses on projects that can be built without Visual Studio:04-make
  5. On the next page select your computer and toolchain:05-machine
  6. Proceed with the default settings for uploading source files:06-storefilesIf you want to avoid multiple users uploading source files to the same directory, you can use the $(USERNAME) macro in the ‘remote directory’ field.
  7. Press “Finish” to generate a project. Ensure that it builds by selecting Build->Build Solution:07-build
  8. Switch to the Team Explorer tab and select the “Pending Changes” view. Visual Studio will automatically show the relevant files from the VisualGDB project. Check them in by pressing “Check in”:08-checkin
  9. Now we will show how to configure TFS to build the VisualGDB project without Visual Studio. This can be done by invoking VisualGDB.exe manually, however we also provide an open-source TFS extension that simplifies this process. Logon to your Team Foundation Server via a browser, click the shopping cart icon and select “Manage Extensions”. Then click “Browse Local Extensions”:09-browselocal
  10. Scroll to the bottom of the page and click “Manage Extensions”:10-manage
  11. Finally click “Upload a new extension”:11-upload
  12. Download the latest release of the VisualGDB build extension and point your TFS console to its location. Finally select it in the extension list and click “Install”:12-install
  13. Select your TFS collection in the installation confirmation dialog and click “Confirm”:13-confirm
  14. Now you can create a new build using the VisualGDB extension. Go to the “Build & Release” tab in your TFS console and create a new build. Then click “start with -> Empty Process”:14-newempty
  15. Locate “VisualGDB Build” on the Build tab and click “Add”:15-addvgdb
  16. In the VisualGDB build settings select the files inside your TFS project that should be built. VisualGDB stores its configuration in the .vgdbsettings files for most of the projects (one file per configuration) and in the .vgdbcmake files for projects using the Advanced CMake Project Subsystem (one file per project). The default settings will build all CMake projects and the release configurations of the non-CMake projects:16-buildrelIf you have any .vgdbcmake projects in your repository, set Configuration Name to “Release”.
  17. Try running the newly created build. The VisualGDB build extension will automatically locate VisualGDB.exe via the %VISUALGDB_DIR% variable, but the build will fail because the connection settings for Linux machines are stored on each developer machine separately and the build server does not have an entry yet:17-conn
  18. The easiest way to transfer the Linux machine settings to the build server is using the Team Settings mechanism (requires Custom edition or higher). On the client machine select Tools->VisualGDB->Manage Team Settings:18-team
  19. Select a directory accessible from both client and server where you would like to store the shared settings (e.g. a shared folder on either machine):19-autobuild
  20. Then go to the “Remote Hosts” page and share the settings for the Linux machine used in build. Check the “shared password with other users” checkbox as otherwise VisualGDB will ask for the password on first build:20-sharepass
  21. Go back to the TFS build settings and specify the shared folder with the team settings in the “Team Settings Folder” field:21-teamdir
  22. Now you can simply queue the build again and it will succeed:22-buildEach time you use a new Linux machine (or a different toolchain), simply share it via the Team Settings window and VisualGDB will automatically configure it on the build machine without any further manual setup.