Prepare your Microsoft Dynamics 365 Business Central Extension for AppSource

Mesam Zahid
3 min readMay 30, 2021

--

If you are developing an extension for Dynamics 365 Business Central, your codebase will be required to follow the guidelines set by Microsoft to publish it on Microsoft AppSource. One of the checklist items [1] is to pass your codebase through built-in code analyzers that build on the compiler’s functionality to offer developers analysis of the syntax and semantics at build time. As of writing this article, The AL Language extension for Visual Studio Code contains four analyzers:

  1. CodeCop is an analyzer that enforces the official AL Coding Guidelines.
  2. PerTenantExtensionCop is an analyzer that enforces rules that must be respected by extensions meant to be installed for individual tenants.
  3. AppSourceCop is an analyzer that enforces rules that must be respected by extensions meant to be published to Microsoft AppSource.
  4. UICop is an analyzer that enforces rules that must be respected by extensions meant to customize a user interface.

Steps to Enable Code Analyzers in VSCode

Open VSCode and your Project, then follow the following steps;

  1. Click on ‘File’
  2. Click on ‘Preferences’
  3. Click on ‘Settings’
  4. A Settings tab will open
  5. Click on ‘Workspace’
  6. Type enablecodeanalysis in the Search
  7. Tick ‘Enable Code Analysis’

You will at this point have a file settings.json in your .vscode folder where your launch.json file is normally found. Open the settings.json file to find the following code;

To enable the code analyzers, add a property al.codeAnalyzers to the JSON object followed by the analyzer(s) you want to enable. In this example, we will enable the CodeCop and AppSourceCop;

At this point, analyzers will run through your codebase and point issues it found with your code, it will show you green/yellow/red lines beneath your code, and you can see the exact “problem” as a tooltip when you hover over it, or in the “problems” — pane. Fixing the suggested issues will prepare your codebase against the selected rules.

NOTE: If you add PerTenantExtensionCop analyzer and are missing Permissions.xml file, you’re going to get a compile error: “Table ‘XXXXX’ is missing a matching permission set”. To generate the Permissions.xml file, update to the latest version of AL Language and run the command; “Generate permission set containing current extension objects” in VSCode’s Command Pallete. This will help ensure that all relevant permission sets are created in XML format and you will have Permissions.xml file in your project.

--

--

Mesam Zahid
Mesam Zahid

Written by Mesam Zahid

0 Followers

Software Engineer

No responses yet