×

    By submitting this form, you are agreeing to Folio3's Privacy Policy and Terms of Service.

    Get a free Consultation

    Earlier we were able to connect our DevOps build pipeline with the Build ERP Box that was part of our cloud ERP instances. But Microsoft discarded the Build server and gave us two options:

    1. Setup an Azure hosted pipeline that will compile the code without doing DB synchronization and prepare a deployable package of FinOps. This approach helps you avoid the setup, maintenance, and cost of deploying build virtual machines (VMs).
    2. Provision a separate ERP box under Cloud-hosted environments then connect the build pipeline with this box. This pipeline can do code compilation of code along with DB synchronization and can prepare a deployable package. Definitely this is going to incur monthly cost.Microsoft Hosted Agents and Azure

    In this blog, we are going to share how to setup an Azure hosted build pipeline.

    Prerequisite

    First step is to prepare projects of all custom models, then need to prepare and push all required artifacts to DevOps. Ensure that the required extensions are installed on DevOps.

    Let’s have a look to all the steps in detail.

    Projects

    We need to add an empty project of every custom model in a solution. Projects type must be Finance Operations.

    Microsoft Hosted Agents and Azure

    Sequencing of all the projects must be correct as per dependency of models.

    Microsoft Hosted Agents and Azure

    Group all projects and solution in a separate folder in DevOps branch along with nuget.config and packages.config files. Will describe these 2 files later.

    Microsoft Hosted Agents and Azure

    Artifacts (NuGet Packages)

    Nuget packages are used to build X++ code. Compiled referenced packages such as Application Suite etc. are also part of this build.

    Some of the Nuget packages are:

    Microsoft.Dynamics.AX.Platform.CompilerPackage has X++ compiler and related tools that are required to do a build.

    Microsoft.Dynamics.AX.Platform.DevALM.BuildXpp has the compiled X++ code for the Application Platform and related modules. This code is optimized for building.

    Microsoft.Dynamics.AX.Application.DevALM.BuildXpp has the compiled X++ code for the Application and related modules. This code is optimized for building.

    Above three packages are required till the platform update 10.0.17. In later versions, Application Suite is split into two packages. So, we need 1 more package i.e.

    Microsoft.Dynamics.AX.ApplicationSuite.DevALM.BuildXpp has the compiled X++ code for the Application Suite module. This code is optimized for building.

    Download nugget packages according to your service update version of FinOps from LCS shared library on your machine.Microsoft Hosted Agents and Azure

    In Azure DevOps, create feed.

    Microsoft Hosted Agents and Azure

    Click on Connect to FeedMicrosoft Hosted Agents and AzureSelect Nuget.exe and copy content for nuget.config file.Microsoft Hosted Agents and Azure

    As mentioned, add a nuget.config file to your project, in the same folder as yours .csproj or .sln file on DevOps branch

    On dev machine, you should have downloaded nuget.exe v4.8.2 or a relevant version. Put nuget.exe and all the downloaded packages in one folder on your machine.

    Download PowerShell script from here and put in same folder.Microsoft Hosted Agents and Azure

    Put nuget.config in same folder as well just for reference.

    Run power shell as administrative and run this script file. if the script keeps asking for your credentials and fails try adding -AddNetfx as a parameter. Reference.Microsoft Hosted Agents and Azure

    Upload all downloaded packages from LCS to Azure artifacts one by one using power shell commands as nuget.exe push -Source “YOURFEEDNAME” -ApiKey az <packagePath>Microsoft Hosted Agents and Azure

    You’ll get prompted for the user. Remember it needs to have enough rights on the project.

    Now, prepare a packages.config file and upload on DevOps branch CICD folder. Reference.

    <?xml version="1.0" encoding="utf-8"?>
    
    <packages>
    
    <package id="Microsoft.Dynamics.AX.Platform.DevALM.BuildXpp" version="7.0.6060.65" targetFramework="net40" />
    
    <package id="Microsoft.Dynamics.AX.Application.DevALM.BuildXpp" version="10.0.886.67" targetFramework="net40" />
    
    <package id="Microsoft.Dynamics.AX.ApplicationSuite.DevALM.BuildXpp" version="10.0.886.67" targetFramework="net40" />
    
    <package id="Microsoft.Dynamics.AX.Platform.CompilerPackage" version="7.0.6060.65" targetFramework="net40" />
    
    </packages>

    Azure Extensions

    Make sure that D365 extension is installed on DevOpsMicrosoft Hosted Agents and Azure

    Build Pipeline Setup

    Create a new build pipeline or import any existing one.Microsoft Hosted Agents and Azure

    Give Pipeline a name and select agent with specificationMicrosoft Hosted Agents and Azure

    Map TFS branchMicrosoft Hosted Agents and Azure

    Keep default values of Compile X++.Microsoft Hosted Agents and Azure

    Set path for Nuget Install PackagesMicrosoft Hosted Agents and Azure

    Keep values of Update Model VersionMicrosoft Hosted Agents and Azure

    Keep values of Copy Binary Dependences to: …

    Microsoft Hosted Agents and Azure

    Set solution path and copy MSBuild Arguments. Reference.Microsoft Hosted Agents and Azure

    Keep default values of Copy X++ Compile Log Files to: …Microsoft Hosted Agents and Azure

    Keep default values of Use Nuget 3.3.0. Version may need to change depending on need.Microsoft Hosted Agents and Azure

    Keep default values of Create Deployable package.Microsoft Hosted Agents and Azure

    Keep default values of Add License to Deploy PackageMicrosoft Hosted Agents and Azure

    Keep default values of Publish Artifact: dropMicrosoft Hosted Agents and Azure

    Save all the changes and run the pipeline and resolve the issues if there are any. Whenever there are new changes checked in TFS in the same branch, we can run this pipeline to build all models to get a deployable package.

    Author

    Lead Software Engineer

    Write A Comment