Sometimes D365FO developers facing the task to import, export, or delete models. Some ISV solutions are provided as model files, which contain programmable objects (metadata and code) and related resources. Also, all the systems customizations should be created in a model. In this blog post we will learn how to management models, using the Fleet Management Extension model as an example.

A model is a group of elements, such as metadata and source files, that typically constitute a distributable software solution and includes customizations of an existing solution. Also, a model is a design-time concept, for example a warehouse management model or a project accounting model. A model always belongs to a package. A package is a deployment and compilation unit of one or more models. It includes model metadata, binaries, and other associated resources. One or more packages can be packaged into a deployable package, which is the vehicle used for deployment on runtime environments.

 

Export a Model

Models can be exported, imported, and deleted using the ModelUtil.exe.

From the Start menu run command prompt as an administrator.

 

Run the following command in the command prompt.

K:\AosService\PackagesLocalDirectory\Bin\ModelUtil.exe -export -metadatastorepath=K:\AosService\PackagesLocalDirectory\ -modelname="FleetManagementExtension" -outputpath=C:\Temp

This command exports the model Fleet Management Extension from the model store to a file. Upon successful completion you should be able to view the model file under the C:\temp folder as shown below.

 

Note: ‘K:’ drive will contain the model store in a Onebox development environment.

 

Delete a model

In the command prompt, run the following command to delete the model Fleet Management Extensions from the model store:

K:\AosService\PackagesLocalDirectory\Bin\ModelUtil.exe -delete -metadatastorepath=K:\AosService\PackagesLocalDirectory\ -modelname="FleetManagementExtension"

 

 

 Navigate to the package's local directory folder in the model store.

Note that that FleetManagementExtension package folder does not contain a subfolder for the  FleetManagementExtension model anymore.

 

 

Import a model

Finally, we will reimport the model FleetManagementExtension which was exported and deleted in the previous steps.

From the command prompt, run the following command to import the model file exported previously.

 

K:\AosService\PackagesLocalDirectory\Bin\ModelUtil.exe -import -metadatastorepath=K:\AosService\PackagesLocalDirectory\FleetManagementExtension -file="C:\Temp\FleetManagementExtension-Microsoft Corporation.axmodel"

  

If you check the model store you can see the model files and folder :

 

I hope this post can help you out, thanks for reading!

 

Acknowledgments: I want to thank my colleague Amy Flower (Customer Engineer) for her contributions and peer review.