Sunday, October 4, 2015

Compile , CIL (Incremental CIL and Full CIL) in AX 2012

well developers new to AX always get hard time to understand compile , Full CIL and CIL , I have jotted down few points from different sources to understand these concepts

Compile :- When the Microsoft Dynamics AX application is compiled, its X++ source code is translated into a machine-executable format that can be interpreted by the Microsoft Dynamics AX server and clients.

What is CIL? 

CIL stands for Common Intermediate Language and it works together with the CLI or Common Language Infrastructure, which is basically a set of rules on programming languages that will compile with the CIL.

Picture is taken from the source:-, which explains the same process in detail

The Common Language Runtime (CLR) that ships with .NET understands the Common Intermediate Language and knows how to execute that code.  The CLR does not need to understand all of the different languages (like C#, VB or F#) it needs to only understand the one language they all get mapped down to, CIL.

In AX you program in X++ and the equivalent of AX's CLR is the kernel.  When you build or compile your X++ code it traditionally gets mapped down to a p-code language that the kernel understands and knows how to execute.

In AX 2012 for certain classes that is what has changed. Now when you compile the X++ code gets mapped down to the Common Intermediate Language.  Then the CLR understands what the code says and executes it -here kernel is not needed.

Write, save, and compile your X++ class :- The X++ source code for your class is automatically compiled into p-code when you save the source in the AOT.

Compile the p-code into CIL :- X++ is compiled into p-code. The p-code can be compiled into CIL by the following menu:

AOT > Add-ins > Incremental CIL generation from X++

Note:- The CIL generation process writes files to an AOS installation subdirectory. The directory path could resemble the following: C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL\

we have two types of CIL compilations, the incremental CIL and the full CIL compilation.

Full CIL :- generate CIL is about to convert the p-code into CIL, referred to as the byte code which, at run time, is used by the CLR to convert into native code for execution on the computer. It is easier to understand that a full CIL generation involves converting all p-code into CIL, finally it converts to the binary Language.

Incremental CIL :- incremental CIL generation involves only the “changed” p-code artifacts that need  to be converted into target CIL. Incremental CIL would compile only the objects that were modified since the last incremental compilation.

In short the major difference between the two of them is that the incremental CIL would compile only the objects that were modified since the last incremental compilation.

Note :- if the installation uses multiple instances of Application Object Server (AOS), all AOS instances must be stopped and then restarted. This causes the AOS instances to load the updated assembly.

No comments:

Post a Comment

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// &l...