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!

6 comments:

Unknown said...

Can you, please, explain in more details how to set up build?

Mike Cano said...

Hi,
I'd like to try out your suggestions, but the screenshots are quite blurry. Is it possible to repost them in a higher resolution or copy the actual code into your post?

Thanks!
M

Huzaifa Gain said...

Can you make youtube video tutorial for doing this job that will be really helpful.

Sergiu Cosciug said...

In TFS 2010 there is used the Windows Workflow to create the Builds. Do you know how to create DAX builds in TFS 2010 ?

aaaa said...

Can you please explain the Build definition changes and commands to run in bat file.

Ashlesh.Patel said...

Hi,

I have integrated the VCS of AX 2009 with TFS(Team foundation server - visual studio 2008) by following the given steps in "Team Foundation Server Version Control Setup Whitepaper for Microsoft Dynamics AX 2009.pdf".

1. Parameters settings





1.1. Team Foundation Sever settings screen





2. Global System settings Screen





I am able to successfully setup the VCS with TFS but when I am opening the AX client, all files under AOT nodes required me to click on "Add to Version Control" to enable Checkout/Checkin procedure.



I have already create the repository from the path "Tools->Developement Tools->Version Control->Setup->Create Repository", after completing this step the infolog shows me no. of files with the "Prending checkin" status.



I have also Synchronize the AX from the path "Tools->Development Tools->Synchronize" with the "Force" flag enabled. It also prompts with completion.





I think I have completed all the required steps which are required to setup VCS of AX 2009 and TFS.

But my question is, Do i required to manually Add all files to Version control using "Add to Version Control" button?

Also please provide me some good resources to find out integration of AX2009 with TFS and implementing Branching of projects for testing and separate development purpose.



Thanks,

Ashelsh Patel

Quick Reply