TFS Build Template

Prerequisities
  1. TFS Build server with installed NAV 2013 R2 and all libraries needed for compilation of your objects
  2. TFS Server with GIT Repository with TXT files of your objects
  3. SQL Server

Known limitations
  1. NAV Server is on build machine (local).
  2. TFS Build account must have admin rights on the SQL (to create database, drop sessions...)
  3. TFS Build account must have admin rights on the Build machine (to create services)
  4. Multiple versions on one server supported, but not different builds
  5. Cannot run builds for different versions in parallel on one server
  6. Running test codeunit is not working yet
  7. Object txt files must be placed in Objects subfolder in the repository

Preparation steps
  1. Place the files and folders from Scripts folder into c:\Program Files\WindowsPowerShell\Modules\ folder on the Build machine
  2. The TFSBuildTemplate folder should be stored in your GIT repo somewhere to be available for the Build Server

Usage
  1. Set the "Custom Libraries" of the Build server to the Custom Assemblies folder
  2. Create new build definition, using the GitTemplateNAV.12.xaml template
  3. Name of the build definition must be without spaces and other special characters (making problems when running finsql.exe from powershell)
  4. Set the parameters of the build definition:
TFSBuildSetup.jpg
  1. NAV DB Backup file - path to the MS SQL backup of NAV database. This will be used for creating new database for the build. Path must be accessible for the TFSBuild agent and the SQL Server
  2. Update FOB File - FOB which will be applied after the DB is restored from backup. Could include e.g. latest Rollup version of objects etc. (should prevent problems with creating unlicensed fields by text import)
  3. License File - flf file which will be used for the database
  4. NAV Ide Path - path to the NAV Dev env which will be used to import/compile/export objects including the finsql.exe part (full path and name of the client exe file)
  5. NAV Testing Codeunit - ID of the codeunit which will be started to run tests (not working yet)
  6. Compile only not compiled - if set, only uncompiled objects will be compiled (it means, which were imported from txt file because are different from the objects already in the database from backup or FOB)
  7. Import FOB from last build - if set, newest FOB file in defined folder will be used instead the "Update FOB file"
  8. NAV Build Drop Folder - this folder will be searched for the latest build FOB file
  9. Drop NAV Server and DB at the end - if disabled, build will not remove the NAV Server instance and SQL Database from the server (for testing or e.g. to have "Latest build server" available automatically
  10. SQL Server - SQL which will be used for creating the database
  11. SQL Server Database Name - name of the created database
  12. Server Instance Name - name of the created NAV instance

FAQ
  1. Q: I have created build definition, queue build, but the build never started
A1: Check the build definition settings in the Process tab, 5. Advanced - Agent settings. Check the tags filter and Tag comparison operator (better is to have MatchAtLeast instead MatchExactly)
A2: I have had same problem when the Build Controller was on TFS server and Build server on different server. Moving the Build Controller to the Build server have solved my problem.



Last edited Jul 7, 2015 at 9:29 AM by kine, version 9