TFS integration with Microsoft Dynamics AX 2012 and automated scripts for build and deployment

For TFS integration,we have come up with a white paper which details what setup is required for using TFS with AX 2012. The white paper is available on information source -

Change management and TFS integration for multi developer projects

It details steps related to creating and deploying Microsoft Dynamics AX builds on computers connected to a central Microsoft Visual Studio Team Foundation Server (TFS) source control system. The document covers two topologies used by Microsoft Dynamics AX developers: private and shared Application Object Server (AOS) topologies.

Once TFS is setup , it is important to have automated build and deployment process. For this , we have provided powershell scripts.

Build and deploy scripts for Microsoft Dynamics AX 2012

 The scripts provide automation for creation and deployment of builds for Microsoft Dynamics AX 2012. The scripts can be used with TFS providing end to end solution for build and deployment. The script performs tasks like sync, creation of TFS label, combining multiple source XPOs to single XPO, validating if build is healthy, etc. These scripts can also work with non-TFS version control where it provides all functionality except the one related to TFS.

 Following scenarios are covered -

1. Creating a build – A Microsoft Dynamics AX build is created from specific versions of source files (XPO files, Visual Studio projects, and label files) in the TFS central repository. Source files that share a common label constitute a specific build of a Microsoft Dynamics AX model or application. Output of a build would be model file(s).

 2. Deploying a build – Developer(s) should be able to deploy model file(s) (generated from build process or manually) in Ax installation(s).

These scripts require some configuration files and parameters which are explained in detail in the above white paper.

Comments (18)

  1. Mudit Mittal says:

    Scripts have been updated for Microsoft Dynamics AX 2012 R2

  2. Hi Mudit,

    Those scripts are very useful when deploying to a developer machine.

    But how do you suggest to deploy to Production? We pbviously can't use the DeployAX script because some pieces of data will be lost.

  3. Rahul says:

    Hi Mudit,

    I am new to AX and 1st time implementing AX build automation using above scripts.

    I got scrpt contents but how to trigger this in TFS 2010, the whitepaper does't details about it.

    Can you provide some pointer on this, how to trigger and configure script in TFS2010?

  4. Not able to get build, getting Error"Exception while mapping TFS workspace. says:


    I followed each step mentioned on newly added script by Microsoft


    however whenever trying to get build from powershell command getting following error.

    Begin: Register-SQLSnapIn: 6/27/2013 4:58:04 PM

    End: Register-SQLSnapIn: 6/27/2013 4:58:05 PM

    Starting Disable-VCS: 6/27/2013 4:58:05 PM

    Done Disable-VCS: 6/27/2013 4:58:06 PM

    Sync files 6/27/2013 4:58:06 PM

    Creating workspace AXBuild_c944b03a-c302-4e89-af6c-dedbfe04418d

    ERROR: *********

    Exception while mapping TFS workspace.

    Deleting workspace.

    ERROR: *********

    Error occured while building.

    Starting Enable-VCS: 6/27/2013 4:58:06 PM

    Done Enable-VCS: 6/27/2013 4:58:06 PM

    Windows PowerShell Transcript End

    End time: 20130627165806

    Waiting for a solution.


    Pankaj Srivastava

  5. Piyush says:

    Hey Pankaj,

    Can you send build parameters you used. That will help in explaining what might be happening?



  6. Rahul says:


    i am facing same issue, getting Error"Exception while mapping TFS workspace"

    Find below parameters-
















  7. Mudit Mittal says:

    @Pankaj – can you share build parameters with Piyush/me , so that we can help out?

  8. @Rahul: Application Soure Dir should not be already mapped in TFS.

    Build scripts will map the folder and sync files. Once sync it will unmap. So make sure application folder is not mapped in TFS.

  9. Neil says:

    I would always deploy a modelstore and never a model to any environment as this enforces the ID's.  Not doing this will trip you up.  Also, why use combine xpo – is it quicker to do that than force AX to sync back to TFS ?

  10. Steve says:

    The CompileVSProjects build file contains a ref to a BuildTasks assembly – where do I find this?? Is it part of the standard AX install?

  11. @Steve: Yes its part of standard install. You will find this in GAC.

  12. Steve says:

    Thanks @agrawalpiyush – I was referencing the wrong version.

    Has anyone used this build script with managed code? The model I generated only contains the dll for a VS project. When it was deployed I got an install error and had to generate a virtual model for my project (this didn't solve the issue though – the code would not compile as there was only a dll in the model)

  13. Chirag Bhagat says:



    I am new to AX I am doing first build with AX can you please help me understand what info to pass on each parameter. I tried to access link you have provided but it is not working

    1. Details for the usage of scripts and parameters is available on…/Rfpservicesonline.aspx



  14. Chirag Bhagat says:



    can you please help me with these error. I am new to AX

    ERROR: *********

    Error occured while building.

    ERROR: *********

    Load : Exception calling "Load" with "1" argument(s): "Access to the path 'F:L

    MS BuildAXCodeDefinition' is denied."

    At F:LMS BuildAXBuildBuildScriptscommon.ps1:824 char:21

    •     $Definition.Load <<<< ($LocalProject)

         + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

         + FullyQualifiedErrorId : DotNetMethodException



    Here is input file



    VCSFilePath=F:LMS BuildAXCodeDefinition

    ApplicationSourceDir=F:LMS BuildAXCodeHSO

    DropLocation=F:LMS BuildAXBuildV0.0.008








    LabelComments=Test build





  15. Vincent N says:

    I agree with you Neil. I would prefer TFS sync on the build server from AX and then export a model store to have consistent object ids between environments.

    In the word document,  page 13 the script is deleting both models before importing new ones from xpo files created by combinedXpos. In that case does it means object ids will be different every time a new build is executed??


  16. Raman Thatikunta says:

    The document is available as a link at…/jj713631.aspx  

    However, the link requires a customer/partner login.

  17. Bharath Byndoor says:

    I have an isue in R3 CU8 while generating the build not sure what the problem is, the error does not occur always. The export command works fine, not sure where it fails

    Error occured while building.

    Export-AXModel : The pipeline has been stopped.

    At S:AXBuildsBuildScriptsCoreR3CU8common.ps1:1386 char:41

    +                 $result = Export-AXModel <<<<  -Model $modelName -File $model

    File -Server $sqlServer -Database $sqlModelDatabase -OutVariable out -Verbose

       + CategoryInfo          : OperationStopped: (:) [Export-AXModel], Pipeline


       + FullyQualifiedErrorId : The specified image file did not contain a resou

      rce section. (Exception from HRESULT: 0x80070714),Microsoft.Dynamics.AX.Fr  


  18. Rusty_Cavalier says:

    Document link is dead in InformationSource. Please refresh the link.

Skip to main content