·
1 min read

Resolving a missing reference during Package deployment

Issue:

When deploying a package to UAT an error occurs:

The running command stopped because the preference variable “ErrorActionPreference” or common parameter is set to Stop: Unable to resolve dependency ‘dynamicsax-dimensionsformadaptor’

Any model in a package you are deploying needs to also include all the models it references if they don’t already exist in the environment you’re deploying to.  We see this commonly with any of the ‘formadapater’ model which, while present on the builder server, are not present on UAT environments.  Form adapter models are used exclusively for automated testing.

Resolution:

  1. On one of the development environments open Visual Studios.
  2. Right click on AOT in the Application Explorer
  3. Select Model View
    pic1-s3
  4. In the model list, find the one referenced in the error; e.g. DimensionFormAdaptor
  5. Right click on the model, select View Package Dependencies > View Incoming References
    pic2-s5
  6. This will display a diagram showing all models referencing this model.
    pic3-s6

Next: Remove the reference from model

  1. Remove the reference from the model
  2. In Visual Studio, click on Dynamics 365 > Model Management > Update Model Parameters
    pic4-s8
  3. Select your model in the drop down, click Next
  4. In the reference packages section unselect the model referenced in the error.

*Note* This is an example of a model reference which shouldn’t be included, it is likely removing a referenced package will result in compile errors.  These errors will need to be resolved before moving forward with a new build.  For unit testing projects which will need to reference formadapter models the best option would be to split these out to separate packages with TEST in their name, so they will not be included in the final package deployment.  Additional details for unit testing: https://ax.help.dynamics.com/en/wiki/tst101-testing-and-validations-in-microsoft-dynamics-ax-7/