Automatically detect the Target Framework Moniker (TFM) for Business Central and download the matching code analyzer files. Build AL extensions with the right analyzers, without manual version juggling. Designed for CI/CD pipelines.
- Detect the TFM from four different sources:
- BC artifact URL (e.g. a sandbox or OnPrem artifact)
- VS Marketplace (the AL Language extension)
- NuGet DevTools (Microsoft's AL development tools package)
- Local compiler path (a directory containing the AL compiler DLLs)
- Download and extract ALCops analyzer DLLs for a detected TFM
- JSON output on stdout, logs on stderr (pipe-friendly)
- Zero configuration required
- Usable as a CLI or as a Node.js library
# Install globally
npm install -g @alcops/core
# Or run directly with npx
npx @alcops/core detect-tfm marketplace- Node.js >= 20
alcops <command> [args]
Commands:
detect-tfm bc-artifact <url> Detect TFM from a BC artifact URL
detect-tfm marketplace [channel|version] Detect TFM from VS Marketplace (default: current)
detect-tfm nuget-devtools [version|channel] Detect TFM from NuGet DevTools (default: latest)
detect-tfm compiler-path <dir> Detect TFM from a local compiler directory
download --output <dir> Download and extract ALCops analyzers
Download options:
--output <dir> Required. Directory to extract analyzer DLLs into
--detect-using <input> TFM detection input (URL, path, channel, or version)
--tfm <tfm> Explicit TFM (skips auto-detection)
--version <ver> ALCops package version (default: latest)
--detect-from <source> Force detection source (bc-artifact, marketplace,
nuget-devtools, compiler-path)
Global options:
--verbose Enable debug-level logging
--help Show this help message
Detect from the VS Marketplace (most common):
alcops detect-tfm marketplaceDetect from a specific NuGet DevTools version:
alcops detect-tfm nuget-devtools 26.0.12345Detect from a BC artifact URL:
alcops detect-tfm bc-artifact "https://bcartifacts.azureedge.net/sandbox/26.0.12345.0/us"Detect from a local compiler directory:
alcops detect-tfm compiler-path ./path/to/compilerThe download command combines TFM detection with analyzer extraction in a single step.
Download analyzers with auto-detected TFM from the latest NuGet DevTools:
alcops download --detect-using latest --output ./analyzersDownload analyzers with auto-detected TFM from a BC artifact URL:
alcops download --detect-using "https://bcartifacts.azureedge.net/sandbox/26.0.12345.0/us" --output ./analyzersDownload analyzers with auto-detected TFM from a local compiler directory:
alcops download --detect-using ./path/to/compiler --output ./analyzersDownload analyzers with an explicit TFM (skips detection):
alcops download --tfm net8.0 --output ./analyzersDownload a specific ALCops version:
alcops download --detect-using latest --output ./analyzers --version 1.0.0Force a detection source with --detect-from (overrides smart routing):
alcops download --detect-using 18.0.2293710 --detect-from marketplace --output ./analyzersEnable verbose logging for debugging:
alcops download --detect-using latest --output ./analyzers --verbose{
"version": "1.0.0",
"tfm": "net8.0",
"outputDir": "/absolute/path/to/analyzers",
"files": [
"/absolute/path/to/analyzers/ALCops.Analyzers.dll"
]
}All commands write JSON to stdout:
{
"tfm": "net8.0",
"source": "marketplace",
"details": "AL Language extension v14.0.12345"
}Logs go to stderr, so you can safely pipe the result:
TFM=$(alcops detect-tfm marketplace | jq -r '.tfm')
echo "Building with TFM: $TFM"- name: Detect TFM
id: tfm
run: |
result=$(npx @alcops/core detect-tfm marketplace)
echo "tfm=$(echo "$result" | jq -r '.tfm')" >> "$GITHUB_OUTPUT"
- name: Use TFM
run: echo "Target framework is ${{ steps.tfm.outputs.tfm }}"Or use the download command for a one-step solution:
- name: Download ALCops Analyzers
run: npx @alcops/core download --detect-using latest --output ./analyzers --verboseThe package exports all detection functions for use as a library:
import { detectFromMarketplace, createConsoleLogger } from '@alcops/core';
const logger = createConsoleLogger();
const result = await detectFromMarketplace('current', logger);
console.log(result.tfm); // e.g. "net8.0"See the exported API surface for the full list of available functions and types.
See CONTRIBUTING.md for development setup and contribution guidelines.