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. Anonymous 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. Anonymous says:

    Hi,

    I followed each step mentioned on newly added script by Microsoft

    (gallery.technet.microsoft.com/…/Build-and-deploy-for-b166c6e4)

    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.

    Regards,

    Pankaj Srivastava

  5. Anonymous says:

    Hey Pankaj,

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

    Thanks

    Piyush

  6. Anonymous says:

    Hi,

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

    Find below parameters-

    Version=

    VCSFilePath=D:XXX_TFSProjNameProjName_CU1ProjName_R1DefinitionVCSDef.xml

    ApplicationSourceDir=D:ProjName_TFSProjNameProjName_CU1ProjName_R1

    DropLocation=D:BuildBackups

    CompileAll=True

    CleanupAfterBuild=True

    CompileCIL=True

    TFSIntegration=True

    TFSUrl=tfs2010.ad.xxx.com/…/bzxxx

    TFSLabelPrefix=PNGBuild_{0}

    TFSWorkspace=$/ProjName/ProjName_CU1/ProjName_R1

    LabelComments=ProjNameBuildComments_{0}

    SignKey=

    MsBuildDir=C:WindowsMicrosoft.NETFramework64v4.0.30319

    RdlLanguage=

    NoCleanOnError=True

  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. Anonymous 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. Anonymous 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. Anonymous 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. Anonymous says:

    Hi

    Mittal

    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

    informationsource.dynamics.com/…/Rfpservicesonline.aspx

    Thx

    Chirag

  14. Anonymous says:

    Hi

    Mittal

    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


    Thx

    C

    Here is input file

    ==============

    Version=0.0.008

    VCSFilePath=F:LMS BuildAXCodeDefinition

    ApplicationSourceDir=F:LMS BuildAXCodeHSO

    DropLocation=F:LMS BuildAXBuildV0.0.008

    CompileAll=True

    CleanupAfterBuild=True

    CompileCIL=True

    TFSIntegration=True

    TFSUrl=http://c1w01144:8100/tfs/tfs01

    TFSLabelPrefix=AX

    TFSWorkspace=$/HPFS_MSD_AX_TFS/Branches/Development/AX

    LabelComments=Test build

    SignKey=

    MsBuildDir=C:WindowsMicrosoft.NETFrameworkv4.0.30319

    RdlLanguage=

    NoCleanOnError=True

  15. Anonymous 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??

    Cheers

  16. Anonymous says:

    The document is available as a link at technet.microsoft.com/…/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

      StoppedException

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

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

     amework.Tools.ModelManagement.PowerShell.ExportAXModelCommand

  18. Rusty_Cavalier says:

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