AX 2012 / D365FnO – HOW TO EXPORT, IMPORT AND DELETE MODEL USING COMMAND PROMPT

D365fno-PostImage

How to export, import and delete model using command prompt.

When we want to move customizations of specific model from one environment to other development environments or customers and partners we need to export and import the model file. Model file contain a model descriptor file, metadata, and source code. This article describes how to export model, import a model file, resolve the conflicts,  and delete a model in a development environment.

How to export the model into model file.

To export an existing model in development environment into a model file, use the ModelUtil.exe tool and the -export directive. ModelUtil.exe is located in the packages bin folder (typically exist, C:AosServicePackagesLocalDirectorybin).

ModelUtil.exe -export -metadatastorepath= [path of the metadata store] -modelname=[name of the model to export] -outputpath=[path of folder where you want to save model file]
EXAMPLE:
C:AosServicePackagesLocalDirectorybin>ModelUtil.exe -export -metadatastorepath=C:AosServicePackagesLocalDirectory -modelname="ModelName" -outputpath=C:ModelBackup

How to install a model in a development environment.

To import an model in development environment from a model file, use the ModelUtil.exe tool and the -import directive. ModelUtil.exe is located in the packages bin folder (typically exist, C:AosServicePackagesLocalDirectorybin).

Stop the following services before import the model (Optional).

  • Management Reporter 2012 Process Service.
  • Microsoft Dynamics 365 Unified Operations: Batch Management Service.
  • Microsoft Dynamics 365 Unified Operations: Data Import Export Framework Service.
  • World Wide Web Publishing Service.
ModelUtil.exe -import -metadatastorepath=[path of the metadata store where model should be imported] -file=[full path of the file to import]
EXAMPLE:
C:AosServicePackagesLocalDirectoryBin>ModelUtil.exe -import -metadatastorepath=C:AosServicePackagesLocalDirectory -file=C:BackupModelName.axmodel

Resolve conflicts from the imported model. 

If you install a model on a development environment that contains customizations to that model (in a higher-layer), you may have to resolve code or metadata conflicts. You can use the development tools to create a project that groups all items that have conflicts.

  1. Under Dynamics 365 > AddIns, click Create Project from Conflicts.
  2. In dialog box, select the model you installed, to check for conflicts.
  3. Click Create project. A new project is generated that contains only the elements in that model that have conflicts.
  4. Resolve the conflicts.
  5. Build the model and synchronize the database.

Delete a model from the development environment.

If you want to delete any model from development environment, or if you trying to import the same model which is already exist in the environment you will receive the error message of “A Model with the same name already exists in the Metadata Store. Please delete the existing model if you want to install this model”. So, delete the existing model by using the ModelUtil.exe tool and the -delete directive. ModelUtil.exe is located in the packages bin folder (typically exist, C:AosServicePackagesLocalDirectorybin).

ModelUtil.exe -delete -metadatastorepath= [path of the metadata store] -modelname=[name of the model to want delete]
EXAMPLE:
C:AosServicePackagesLocalDirectorybin>ModelUtil.exe -delete -metadatastorepath=C:AOSServicePackagesLocalDirectory -modelname="ModelName"

ATTENTION:
Please make sure the Back-Slash (\) in the directory path.

This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.