Importing a Dynamics AX XPO file in Business Connector session is not possible


Recently I was asked the question how it is possible to import a Dynamics AX XPO file to Dynamics AX from X++ code. This is actually possible using the SysImportElements class.


However this approach does not work if the XPO file should be imported in a Business Connector session. When the the import method of the SysImportElements is called in this scenario it fails with the following error message:


Image List Object is not initialized.

The classes used in this context were simply not designed to work in a Business Connector session, as several user interface elements are accessed that are not available with the Business Connector.


Instead of using the .NET Business Connector to import a XPO file the Dynamics AX Client can be called with command line parameters to automatically import a XPO file.


To import the XPO without compilation, run:


ax32.exe -AOTIMPORTFILE=c:\path\import.xpo -lazyclassloading -lazytableloading -minimize -nocompileonimport

To compile all the code, run:


ax32.exe -lazyclassloading -lazytableloading -startupcmd=CompileAll -minimize

Comments (4)

  1. benjguin says:

    not sure -nocompileonimport works with AX 2009…

    Does one need to synchronize database afterwards? Or is this done by -AOTIMPORTFILE?

  2. EMEAAXTec says:

    The flag -nocompileonimport still exists in AX2009.

    No, if you need to synchronize the database you should call:

    ax32.exe -startupcmd=synchronize

    In the example above I would do this before the compile.

  3. Shaik Khwaja says:

    If we remove "-nocompileimport" then all the code get compiled. But it will be really great if we can a Command Line argument only to compile  specified files you imported rather than Compiling all the code in AOT.