In this blog I will try and explain the minimum setups needed to prepare a build server to create builds.
In order to setup a build server, so a build script can assemble an app I do the following steps:
Create a folder called “ALBuild” on the C drive in the root.
Make a folder called “Scripts” folder under “ALBuild”
Create a PowerShell file in the Script folder called “build.ps1”.
Put the following code in the build.ps1 file:
$ExtensionAppJsonFile = “.\app.json”
$ExtensionAppJsonObject = Get-Content -Raw -Path $ExtensionAppJsonFile | ConvertFrom-Json
$Publisher = $ExtensionAppJsonObject.Publisher
$Name = $ExtensionAppJsonObject.Name
$ExtensionAppJsonObject.Version = ‘1.0.’+$env:Build_BuildID + ‘.0’
$ExtensionName = $Publisher + ‘_’ + $Name + ‘_’ + $ExtensionAppJsonObject.Version + ‘.app’
$ExtensionAppJsonObject.Version = ‘1.0.’+$env:Build_BuildID + ‘.0’
$ExtensionAppJsonObject | ConvertTo-Json | set-content $ExtensionAppJsonFile
$ALProjectFolder = $env:System_DefaultWorkingDirectory
$ALPackageCachePath = ‘C:\ALBuild\Symbols’
Write-Host “Using Symbols Folder: ” $ALPackageCachePath
$ALCompilerPath = ‘C:\ALBuild\bin’
Write-Host “Using Compiler: ” $ALCompilerPath
$AlPackageOutPath = Join-Path -Path $env:Build_StagingDirectory -ChildPath $ExtensionName
Write-Host “Using Output Folder: ” $AlPackageOutPath
Set-Location -Path $ALCompilerPath
.\alc.exe /project:$ALProjectFolder /packagecachepath:$ALPackageCachePath /out:$AlPackageOutPath
Make a “Symbols” folder under the “ALBuild” folder.
Copy the latest Symbols files from the build you are currently developing on. I assume everyone knows how to find these at this point.
You will need to update these as new builds are released.
Copy the bin folder normally found here:
“C:\Users\<username>\.vscode\extensions\Microsoft.al-0.14.17461”
on your development machine to the “ALBuild” folder on your build server.
The version might be different, but this is part of the extension installed in VSCode. You will need to update this when a new version is released of the AL extension for VS Code.
This is it. The build server is now complete and has all the components needed to run builds. In Part 3 we will show you how you can configure a build in VSTS via your browser
A special thanks to Mike Glue for sharing his great knowledge with me.