Resolving a missing reference during Package deployment
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.
- On one of the development environments open Visual Studios.
- Right click on AOT in the Application Explorer
- Select Model View
- In the model list, find the one referenced in the error; e.g. DimensionFormAdaptor
- Right click on the model, select View Package Dependencies > View Incoming References
- This will display a diagram showing all models referencing this model.
Next: Remove the reference from model
- Remove the reference from the model
- In Visual Studio, click on Dynamics 365 > Model Management > Update Model Parameters
- Select your model in the drop down, click Next
- 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/