AL Pre-Processor

Did you ever find yourself in the situation, where you needed some source code, which should not be included in the final release? Did you wanted to create several versions of your product or target multiple platforms?

Our free AL pre-processor can help you by allowing you to check constants in your AL code.

Example: Use .NET only if not targeting an extension

The basic idea behind a pre-processor is to get an input containing pre-processor commands and to create an output without them. The commands are evaluated during the creation of the output file. By changing the variables you pass to the pre-processor you can change the created output file.

The syntax of the pre-compiler is optimized to work with AL code. The whole line containing the pre-processor instructions are removed from the final code. This allows you to use comments in a way that you can always compile one target from Visual Studio code directly, without running the pre-processor first.

Use cases

There are a lot of use-cases. For example, you can use the pre-processor to create different versions of your module, you can include performance or debug information in certain builds. As shown above you can use it to target different platforms, like Microsoft Dynamics 365 Business Central Cloud and On-Premise.

In combination with out cross-compiler you can even create your C/AL objects directly from your AL code. This will allow you to develop for several targets or to use VS Code today with older installations.

Download

Download Preprocessor V1. Please unzip the file, and put all files in one directory. There is no installation required.

Frequently Ask Questions

  • What variables can I use?
    • It is up to you. You can define any variable you like, check it’s value an whether it is defines. Typically you will use variables, like DEBUG, TARGET, TARGETVERSION etc.
  • Can I use the pre-processor on C/AL code
    • The pre-processor if optimized for AL code. You can run it on any text based files, but you do not have the advantages of using the comments in the way they are used for AL.

Documentation and Help

Official Documentation

If you need any help using our tools and did not find the information you’re looking for, please don’t hesitate to contact us.