Sunday, 3 November 2019

Azure DevOps for Dyn365FO Create Deployable Package - Include Source Controlled ISV Binaries

Background

This post will be a little different to my recent articles which have been in an step by step guide format. Instead, it's an addition to the guide for replacing your Create Deployable Package build step, which will allow you to include source controlled binaries in the Deplyable Package generated by Azure DevOps.


Prerequisites

If you are looking for a guide to implementing the Create Deployable Packages Azure DevOps Task by Microsoft, see my post here;

Azure DevOps Build & Release Pipeline for Dyn365FO - Create Deployable Package Task

For adding your ISV binaries to source control, so that your build box can include them as part of your single generated deployable package, see here;

Manage third-party models and runtime packages by using source control


Background


When I implemented the Create Deployable Package task in an implementation project recently, I noticed that the package size generated by the new Task, compare to the old Powershell Script, was significantly smaller. The new Zipped package was 25MB, when I was expecting it to be closer to the 135MB package generated previously.


Problem


On inspection, the problem was that the new package only contained binaries from any source code built by the agent during this run. So in this example, it contained our customer implementation model, but none of the ISVs which we also store in source control. 


Solution


On the build box, in the working folders for the build agent, the folder I setup in the build task parameters only contains the built binaries, and not the source controlled ISV binaries;

$(Agent.BuildDirectory)\Bin

 The folder which contains everything from source control is actually;

$(Agent.BuildDirectory)\s\Metadata

To include both folders, a change is needed to the Create Deployable Package task parameter for location of binaries.


Create Deployable Package - Old Parameters

In the Location of X++ binaries to package field, remove the \Bin folder;

$(Agent.BuildDirectory)

In the Search pattern for binaries to package field, replace the * with the following to include both folders;

Bin/*
s/Metadata/*


Create Deployable Package - Updated Parameters


It is important to note here, that the Search pattern for binaries to package uses Azure DevOps file matching patterns, which use the forward slash to denote directories, even when your build server is running on Windows. Read more about them here;

File matching patterns reference

Save and queue the pipeline, and on the next run your binary ISVs will be back.



6 comments:

  1. Great Blog, really useful, thanks :)

    ReplyDelete
  2. Thanks, this is very useful for the all-in-one package!

    ReplyDelete
  3. Hi, ive tried this and still getting the same error. I have copied the above settings and it worked for one build but has since failed with the following log :

    2021-01-05T13:24:19.0114723Z Authenticating with AAD on https://login.microsoftonline.com/common/oauth2 for API https://lcsapi.lcs.dynamics.com
    2021-01-05T13:24:20.9275486Z Start deployment V2
    2021-01-05T13:24:26.0507556Z ##[error]Error in request to deploy file asset: 'Deployable package environment validation failed' (Operation Activity Id: 'b2b7d280-80de-4aa4-910b-f2bd1edfd290')
    2021-01-05T13:24:26.1167099Z ##[section]Finishing: Deploy to environment FAT

    ReplyDelete
    Replies
    1. Hi Jack, haven't checked back in a while did you get sorted?

      Delete

Thanks for the feedback!