Thursday, December 5, 2013

Exporting models from AX 2012 with .Net Runtime version 2.0

I work with some servers where models from the model store are exported with .NET Runtime version 4.0 when using the PowerShell Management Shell:

I cannot be sure to be able to import models with this Runtime version at all customers. Depending on their system they might get an error about the model file having an invalid format. See this article at Dynamics Ax Musings.

TechNet offers a couple of workarounds under Troubleshooting working with model files section. Making changes to our customers servers is however not always an option.

You can change the version number after the export, as described here, but that's an extra step that I'd like to skip.

It seems like by just adding a version parameter to the "Microsoft Dynamics AX 2012 Management Shell" shortcut you can start up PowerShell as another version and you'll now get the expected Runtime version in the exported models. Here's the needed change to the shortcut:

You can the check the version PowerShell runs under, with the Get-Host command: