Compile, publish, and debug
Compiling, publishing, debugging and profiling AL extensions for Business Central in Visual Studio Code. It answers questions about breakpoints, attach and snapshot debugging, the AL Profiler, compilation scope, app signing, Entra authentication on-premises and RAD publishing.
- 12Learn pages
- 1videos
Path: Development > Development environment > Compile, publish, and debug · tier official · system administration · narrative unreviewed (model text not yet checked)
Overview
This section covers the daily build and troubleshoot loop for AL developers. It includes compile settings (compilation scope with OnPrem or Cloud target levels, and Rapid Application Development publishing with delta compilation), debugging tools, performance analysis, and packaging.
The debugging pages build on each other. Start with “Debug AL Code in Visual Studio Code” for breakpoints, break on errors and record changes. Then go to conditional breakpoints, attach and debug next (for sessions not launched from VS Code), debugging install and upgrade code, and snapshot debugging for recording on a server and inspecting offline. The MCP Server for AL page covers AI-assisted analysis of call stacks and variables with GitHub Copilot. Another page covers starting a VS Code debugging session directly from the web client.
Other pages cover the AL Profiler for finding performance hot spots, signing app package files with Azure Key Vault or PFX certificates, and using Microsoft Entra authentication for on-premises and container servers from VS Code.
Key points
- The AL Profiler records in instrumentation or sampling mode, set in launch.json, and shows call stacks, timings and SQL calls in VS Code, with CodeLens timings.
- Attach and debug next uses breakOnNext to attach to web client, web service, background or agent sessions, and can target a sessionId or userId.
- Conditional breakpoints pause only when a condition is true, with comparison and logical operators (version 26).
- Snapshot debugging records execution on the server using snappoints and replays it offline in VS Code. An AI agent can do this through the MCP server.
- Install and upgrade codeunits can be debugged with attach debugging and by publishing without building.
- Compilation scope is set with ExtensionAllowedTargetLevel on the server and the target property in the manifest (OnPrem or Cloud). It controls which APIs and .NET types are available.
- App packages are signed with Azure Key Vault or a PFX file, using managed identity or service principal authentication. Self-signed certificates are for testing only, and Marketplace submission has certificate requirements.
- RAD publishing uses delta compilation, a .rad file and rad.json to shorten build and publish times for large projects.
Learn pages
- Analyze AL Performance with the AL Profiler: Use instrumentation or sampling with the AL Profiler to analyze AL execution, SQL activity, call stacks, and performance hot spots.
- Attach and Debug Next in Business Central: Attach the AL debugger to an existing or next session in Business Central. Configure web client, web service, background, and agent session debugging.
- Compilation scope overview: This article explains the configuration and compilation scope for publishing the extension.
- Debug AL Code in Visual Studio Code: Debug AL code in Visual Studio Code by using breakpoints, attach sessions, record-write breaks, SQL statistics, and debugger settings.
- Debug Upgrade and Install Code in AL: Debug AL install and upgrade codeunits by attaching to Business Central before you publish an extension from Visual Studio Code.
- Set Conditional Breakpoints in AL: Set conditional breakpoints in Visual Studio Code to pause AL code only when variables, fields, or supported expressions meet a condition.
- Sign an App Package File for Business Central: Sign Business Central AL app packages with Azure Key Vault or a PFX certificate, review signing prerequisites, and check package signatures.
- Snapshot debugging: Overview of how snapshot debugging allows recording running AL code for Business Central.
- In the observatory: Codeunit 80 “Sales-Post”
- Troubleshoot in Visual Studio Code directly from the web client: Opening Visual Studio Code directly from the Business Central web client to perform troubleshooting.
- In the observatory: Page 2500 “Extension Management”, Page 9631 “Page Inspection”
- Troubleshooting MCP Server for AL: Learn how to use the Troubleshooting MCP Server to analyze runtime state during debugging sessions with AI-powered insights in AL.
- Use Microsoft Entra authentication for Business Central on-premises installations: Using Microsoft Entra ID as authentication on on-premises installations and containers for Business Central for debugging and other purposes
- Work with Rapid Application Development: Describes what Rapid Application Development is and how you publish using RAD.
Videos, posts and code changes
Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.
- #12320 Fix 409 conflict in APIV2 Company Info E2E description test (code change): “Fixed 409 conflict errors in APIV2 Company Info E2E tests”
- What’s New: Developer Tools (2024 release wave 1) (video): “object extensions; al language; al tool; pipelines; co-pilot; tooltips; secret text”
Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.
What Learn documents here 8 of 12 Learn pages
- learnAnalyze AL Performance with the AL Profiler2026-10-07
- learnAttach and Debug Next in Business Central2026-10-15
- learnCompilation scope overview2025-05-18
- learnDebug AL Code in Visual Studio Code2026-10-07
- learnDebug Upgrade and Install Code in AL2026-10-07
- learnSet Conditional Breakpoints in AL2026-10-07
- learnSign an App Package File for Business Central2026-11-30
- learnSnapshot debugging2026-09-25