Monday, September 22, 2008

Building AX solution with TFS

Since MS introduced TFS version control in DAX 2009 I got an idea to leverage TFS build functionality. It is great advantage to have build work done in three mouse clicks or even scheduled to be done while I'm sleeping. This also gives confidence that all project related files are in right place and at right time.

In frame of AX, Build is source code file combined from separate compiled without errors pieces of code that belongs to same solution together with label file.

I assume that you are familiar with TFS if not I recommend starting from reading MSDN.

The setup process consists of several steps:

  1. TFS: First of all TFS server must be installed.
  2. Build agent: TFS build agent must be installed and run on behalf of user registered in AX. Usually it is non-interactive domain user. Here you can find more information about creation and management of Build Agents.
  3. Version control: I assume that all project related AX objects are checked in into TFS source control. This document describes how to set up the version control system for Microsoft Dynamics AX 2009 using Microsoft Visual Studio Team Foundation Server.
  4. ID Server: this document describes how to install Team Server, which is the ID server that is required if you use Team Foundation Server or Microsoft Visual SourceSafe for version control.
  5. Fake solution: TFS needs solution to build. Since we just need to get sources, combine them and put in right place one can create "fake" solution - empty solution to make TFS happy with building something "real". This "fake" solution has to be created and added to source control.
  6. Build definition: this document describes how to create a build definition. Later you can edit it. Actually if everything was setup correctly in build definition wizard only two corrections are needed for sources to get *.xpo files only and "After
    Get" task:


  7. Put CombineXPOs.exe found here to yourBuildDirectoryPath folder.
  8. Next step might be build scheduling.
  9. Next you can create bat file to import your just generated build into AX:

    That is why build agent has to run with AX user credentials.

When everything is checked in and CombineXPOs.exe is in right place you are ready to generate your first AX build. To queue new build just right click on build definition in the Team explorer, select "Queue new build" and click "Ok". This document describes how to Queue new build if you need more information. And voila... build is generated.

You can easily access to your builds by right click and "Open drop location". 

I believe this simple routine will save a lot of time for you!