D365 For Operations - Upgrade your existing build definition and how to blacklist models in deployment packages

Update: Since writing this post, Microsoft has updated their own documentation on how to achieve blacklisting models in the build.  The article can be found here.

The Dynamics 365 for Operations Wiki is a great place to gather information about new features and technical documentation for D365.  For example, this page has information on what is new in each of the the Update package.

Over the course of the periodic updates, the build definition has added several new features such as automatically updating version number of your models to match the build definitions version number, or allowing blacklisting of models in your deploy-able package (the scope of this post).

This is an important new feature, especially for those projects who are utilizing the excellent unit testing framework in D365 (which you should be!).  For example, you most certainly want your unit tests to be build and run as a part of your continuous integration strategy, but when it comes time to generate the deployment package, you will definitely want to exclude your unit test model; your production systems have no need for that extra baggage.

The problem however is that as of the time of this writing, no additional information can be found on the wiki regarding this feature, such as how it works or how to enable it on your current build definition.

There are a few ways to enable this new feature in your build.  The first would be to provision a brand new build server from LCS targeting update 6.  In many cases this is undesirable, or difficult to schedule time and.or resources.

Another, as detailed in this blog post, as pointed out by Joris de Gruyter is another viable option, but involves logging into the build server directly and knowing your VSTS access token.

The other, and much easier method (IMHO), is to modify the build definition manually and add in the new parameters required to support the new feature.

Note: The following method assumes that your build server has has the Update 6 package applied to it, as that package will contain the updated power shell scripts to support the new build definition variables.

Without going into too much detail on how this information was derived, here are the steps required to update your build definition:

1. Edit the build definition



2. Select the variables tab and add the following two variables:

  • Name: PackagingExclusions, Value: [Comma delimited list of models to exclude from the package]
    • The package name(s) must match the physical directory name of the model in the J:\AosServices\PackagesLocalDirectory
  • Name: IncludeBinariesInRuntimePackage, Value: 1
    • This is another variable introduced in Update 6, but is not in scope of this post

3. Open the tasks tab and select the Generate Packages step
4. In the arguments field, append the following arguments to the argument string
  • -ExclusionList "$(PackagingExclusions)" -IncludeBinaries:([bool]$(IncludeBinariesInRuntimePackage))

After saving the build definition and running the build, the logs will confirm output of the correct parameters to the GeneratePackages.ps1 script, and you should see messages indicating the selected model(s) were skipped during the package generation!




Now if we could just get the TestFilter variable to work....


Comments

Post a Comment

Popular posts from this blog

SQL Reporting Services - Viewer broken in Non-IE Browsers: FIX

Dynamics AX 2012 - Visual Studio Team Services Custom Work Item Fields Break Version Control (Error TF237121)

Dynamics AX SysFileDeployment Framework - Deploy files automatically (using resources) to the client on login