Export and Import a Model AX 2012
A model is a set of elements
in a given layer. Each layer consists of one or more models. Models can be
exported to files that have the .axmodel extension. These files are called
model files. Model files are deployment artifacts that can be imported into a
model store.
A model is permanently associated with the layer that is
created in. If you need to move one of your models from one layer to another,
you must create a project from the model in the AOT, export the project as an
xpo file, create a target model in the desired layer, delete the original model
to avoid having to resolve layer conflicts, and import the xpo file to the
target model. If you are moving elements between models in the same layer, you
can use the Move to model command in the AOT.
You can use either Windows PowerShell cmdlets or the
AXUtil command-line utility to export models to model files and import model
files into a model store.
Important
In Microsoft Dynamics AX 2012, element IDs and element
handles are assigned during installation. Therefore, you must avoid
randomizing element IDs and element handles when you install models. In
general, never delete a model and then reinstall it. Always install a model
over an existing model. For more information, see Maintaining
Installation-Specific Element IDs and Element Handles.
·
Drain client connections and validate
permissions
·
Drain the client connections to the Application
Object Server (AOS) instance that you are working with. For more information,
see Drain
users from an AOS.
·
Validate that you have appropriate permissions
to work with the model store:
o Administrative
permissions on the local computer
o System
Administrator rights in Microsoft Dynamics AX
·
In Microsoft SQL Server:
o Membership
in the Securityadmin server role on the SQL Server instance
o Membership
in the db_owner role in the Microsoft Dynamics AX database
You can export a model file if you want to distribute it
internally or to customers. If you plan to distribute a model file to
customers, we recommend that you strong-name sign the model. To strong-name
sign a model, you must use the Strong
Name Tool, SN.exe, to generate a key pair file.
Export an .axmodel file
(Windows PowerShell)
1. On
the Start menu, point to All
Programs, point to Administrative Tools, and
then click Microsoft Dynamics AX Management Shell.
2. At
the Windows PowerShell command prompt, PS C:\>, type the following command,
and then press ENTER.
·
Windows PowerShell
Export-AXModel –Model <name> -File <Filename.axmodel>
This example exports the
specified model to a file that has the specified file name.
You can use the –Server, –Config, or –Database parameters to specify the environment to export
from.
You can also use the -Key parameter to specify the strong-name key pair file to
use to sign a model.
For more information, see Export-AXModel.
3. You
can also use the Sign Tool to sign the file with a digital certificate, or the
AXUtil genlicense command to Authenticode sign a file. For more information,
see:
Export an .axmodel file
(AXUtil)
1. On
the Start menu, click Command prompt.
2. Navigate
to the directory for the management utilities. Typically, the location of this
directory is %ProgramFiles%\Microsoft Dynamics AX\60\ManagementUtilities.
3. At
the command prompt, type the following command, and then press ENTER.
axutil
export /model:<modelname> /file:<filename> /verbose
This example exports the
specified model to a file that has the specified file name.
You can use the [/key:SNK-file] parameter to specify the strong-name key pair
file to use to sign a model.
4. You
can also use the Sign Tool to sign the file with a digital certificate, or the
AXUtil genlicense command to Authenticode sign a file. For more information,
see:
When you import a model, elements in the model that you
are importing may conflict with another model in the same layer. In this
situation, you can create a conflict model in the
patch layer that is associated with the layer that you are working in. You can
then resolve the conflicts in the conflict model.
By default, when you import a model from Windows
PowerShell or AXUtil, the installation mode is set to display the Model code
upgrade checklist when the Microsoft Dynamics AX client starts. If you import a
model by using Setup.exe, by default, the installation mode does not display
the Model code upgrade checklist. For more information about importing a model
by using Setup.exe, see:
By default, optimization steps, such as reindexing the
model store, are performed when a model is installed for the first time.
Optimization steps are also performed if the number of elements in a model
increases by more than 50 percent when the model is reimported. For more
information, see How to:
Optimize a Model Store for Runtime.
Import an .axmodel file
(Windows PowerShell)
1. On
the Start menu, point to All
Programs, point to Administrative Tools, and
then click Microsoft Dynamics AX Management Shell.
2. At
the Windows PowerShell command prompt, PS C:\>, type the following command,
and then press ENTER.
Windows PowerShell
Install-AXModel -File <Filename.axmodel> -Details
This command installs the
specified file in the same layer that it was exported from.
You can use the –Server, –Config, or –Database parameters to specify the environment to import to.
By default, you will be
prompted to install the model based on whether it has been signed. The
following table describes the prompts shown.
Scenario
|
Prompt
|
The model file is not signed.
|
The model is not signed. Are you sure you want to
install this model (Y/N)?
|
The publisher is recognized from the digital
certificate.
|
The model is signed by ‘{0}’”. Would you like to
continue (Y/N)?
|
The publisher was not available from the digital
certificate.
|
The certificate for the model was not recognized. Are
you sure you want to install this model (Y/N)?
|
The provider for the certificate is unknown.
|
The certificate for the model was not recognized. Are
you sure you want to install this model (Y/N)?
|
If the installation fails because of a conflict, we
recommend that you rerun the cmdlet, and use the -Conflict Push option to push
the element that has the conflict to the related update layer. You can then
resolve the conflict. For more information, see How to: Resolve
Conflicts After Importing a Model.
For more information, see Install-AXModel.
Import an .axmodel file
(AXUtil)
1. On
the Start menu, click Command prompt.
2. Navigate
to the directory for the management utilities. Typically, the location of this
directory is %ProgramFiles%\Microsoft Dynamics AX\60\ManagementUtilities.
3. At
the command prompt, type the following command, and then press ENTER.
axutil import
/file:<filename> /verbose
This command installs the
specified file in the same layer that it was exported from.
If the installation fails
because of a conflict, we recommend that you rerun the command, and use the /conflict:push option to push
the element that has the conflict to the related update layer. You can then
resolve the conflict. For more information, see How to: Resolve
Conflicts After Importing a Model.
Comments
Post a Comment