Home | Print | Archive | Blog | Contact
A Newsletter for Unisys EAE and Agile Business Suite Clients | December 2017

Engineering Corner: Using Batch Scripts, TFS, and DPM

Agile Business Suite (AB Suite®) Release 6.1 includes built-in support for basic DevOps capabilities using Team Foundation Build (TF Build) for the Windows Runtime.

And, steps to automate system deployments are detailed in the AB Suite product support documentation. Under the “HowTo/Team Foundation Server” section, you’ll find a link to a zip file containing an overview of the feature and general steps. It also includes a useful demonstration project that uses PowerShell scripts to run the deployment operation on the Sample system.

The demonstration, while fairly straightforward, was carefully chosen to illustrate how a number of unique AB Suite capabilities can work together with TF Build to provide a more streamlined DevOps experience.

The main engine for AB Suite DevOps lies in the TF Build process, which orchestrates the steps of the deployment operation. Of course, TF Build is tightly integrated with Microsoft® Team Foundation Server (TFS) itself, so it’s directly aligned with all recommended AB Suite development lifecycle management processes.

In earlier AB Suite releases, we introduced the use of msbuild – the standard Microsoft build engine – to build pre-defined AB Suite .smproj projects. The idea is, you set the project once – including importing and configuration – and msbuild.exe can be used by TF Build in the AB Suite application. There are some setup steps that you need to be aware of first, however.

Setting Up TF Build

Before you can get TF Build to build your .smproj project, it’s important to set up your Visual Studio environment for the TFS agent. First, look in the TFS Admin Console and download the VSO agent.

Then, run the included ConfigureAgent.cmd to install a “VSO Agent” service.

During installation, you get to specify a service account – ours is simply “Administrator” above, though we do recommend a dedicated administrative account instead of the default “Administrator.” Whichever account you choose, you’ll need to start Microsoft Visual Studio® at least once using that account in order to establish the necessary user profile and paths.

Since the TF Build agent will run under this service account, it’s important to make sure your default Build Output Directories are set to the desired location.

The job you set up in TF Build also has a default timeout of 60 minutes, so you’ll need to adjust it based on the expected time your AB Suite application buildnormally takes.

In most cases, creating the AB Suite application package – the MSI file – will only require you to use an msbuild step in the Build Agent. It’s also possible to use msbuild to perform end-to-end deployments, but the packaged example assumes additional deployment steps.

And it’s during these additional deployment steps that the DevOps integration capabilities in AB Suite really come into their own. To illustrate, the example looks at two post-build steps: the use of the Deployment Package Manager (DPM) tool and the deployment of the built MSI file itself.

Driving DPM

One of the unique features of the AB Suite Runtime for Windows is the ability to modify the application MSI file post-generation using DPM. Part of the AB Suite Runtime for Windows, DPM recompiles a small part of the application without touching the binaries that contain the application logic itself. Though it offers both GUI and command-line interfaces, we use the command-line version – DPM-Console.exe – in TF Build. The command line in the example is as follows:

C:\DeploymentPackageManager\DPM-Console.exe -N -B=”C:\intermediate\SampleDeploy.msi” -ConfigurationData C:\TFSDEVOPS\Reconfiguration\ReConfigSample.txt -SchemaName=Sample1Clone -SystemName=Sample1Clone -OutputPath=C:\TFSDEVOPS\ClonedPackages -DatabaseName=testClone -ServerReg=db -PackageName=Sample1NewClone -PkgInstDir=”c:\installClone” –o

The “DPM-Console” executable creates a new MSI using the supplied SAMPLEDeploy.msi as input. Deployment properties, such as a unique SystemName, PackageName, and installation directory, are also supplied. And, notably, we can also change the Location properties originally specified in the application model. The ReConfigSample.txt would like this:

As a result, DPM allows you to change most of your application’s built-in settings, giving you the freedom to deploy a second instance – without it clashing with existing copies – or match it with a variety of different environments with no regeneration required.

Managing Deployment

Application deployment relies on the solution’s Runtime Transfer capabilities, which allow application MSI files to be deployed locally without using Developer. The feature is also available as a command line – DeployPackage.exe – and as part of a small number of administration utilities included in the AB Suite Runtime for Windows. These utilities provide a command-line interface to the more commonly used operations in the AdminTool GUI. They’re also available as a programmatic API using
the following assembly:

Unisys.AgileBusiness.RuntimeAPI.dll.

Our TF Build example uses the DeployPackage.exe:

C:\Program Files\Unisys\AB Suite 6.1\Bin64\DeployPackage.exe” /L C:\TFSDEVOPS\ClonedPackages\Sample1NewClone.msi /U MyAppUser /P SecretPassword2017*

This deploys the modified MSI package we created using DPM, including the supplied application user credentials.

Adding the Batch File to the Build Definition

To start, package up both command lines in a batch file, like the following example:

Then, add it to the build definition:

This way, TF Build will be able to perform both steps after the MSI is created.

Other Possibilities

Another thing you could do is automate the initial run of Visual Studio mentioned above by creating a batch file similar to the example below, then adding it to TF Build.

echo off
runas /user:MyAdministrativeBuildUser “%VS140COMNTOOLS%..\IDE\devenv.exe”

TFS can automate many more administrative steps, such as copying files, checking prerequisites, and building external projects.

Subscribe | Unisys.com | Comment | Newsletter Archive