
{"id":1352,"date":"2019-10-30T09:50:18","date_gmt":"2019-10-29T22:50:18","guid":{"rendered":"https:\/\/www.bakke.online\/?p=1352"},"modified":"2022-01-22T20:10:55","modified_gmt":"2022-01-22T09:10:55","slug":"dynamics-ax-2012-managing-duplicate-model-names","status":"publish","type":"post","link":"https:\/\/www.bakke.online\/index.php\/2019\/10\/30\/dynamics-ax-2012-managing-duplicate-model-names\/","title":{"rendered":"Dynamics AX 2012 &#8211; Managing duplicate model names"},"content":{"rendered":"\r\n<p>Recently I came across a situation where I had multiple models with the same name in one of the AX 2012 instances I am developing for. It is possible to do this through the AX developer workspace as long as they have different publishers, but it causes the model management Powershell cmdlets to freak out a bit.<\/p>\r\n\r\n\r\n\r\n<p>Recently I came across a situation where I had multiple models with the same name in one of the AX 2012 instances I am developing for. It is possible to do this through the AX developer workspace as long as they have different publishers, but it causes the model management Powershell cmdlets to freak out a bit.<\/p>\r\n\r\n\r\n\r\n<p>In my case, I wanted to delete one of the models so I would not have duplicate names, but when I tried to use Uninstall-AXModel, I got an error message saying:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\"> uninstall-axmodel : The pipeline has been stopped.\r\n At line:1 char:1\r\n uninstall-axmodel -server DEVSRV -database DynamicsAX_Dev_model -m \u2026\r\n <del>~~~~~~~~~~~~~<\/del>~~~~ CategoryInfo          : OperationStopped: (:) [Uninstall-AXModel], PipelineStoppedException\r\n FullyQualifiedErrorId : Multiple models exist with the name temp.,Microsoft.Dynamics.AX.Framework.Tools.ModelManagement.PowerShell.UninstallAXModelCommand <\/pre>\r\n\r\n\r\n\r\n\r\n\r\n<p>So&#8230; What to do? The documentation only refers to the -Model parameter being a string, and what I could find online just says this should be the name of the model.<\/p>\r\n\r\n\r\n\r\n<p>A hint to the solution was to be found in the usage text for the old-style axutil command. It mentions being able to use a model ID instead of a model name:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">\/model:{model-name | '(' model-name , publisher')' | <strong>model-id<\/strong>}\r\n\r\n    Specifies one model in the model store. The model can be identified by:\r\n\r\n      * Name - name that uniquely identifies exactly one model in the store.\r\n\r\n      * Two-part unique name - values must be contained in parentheses,\r\n\r\n          and comma separated.\r\n\r\n      * <strong>ID - the model store specific number which can be found using the\r\n\r\n          list command<\/strong>.\r\n\r\n    Example: axutil exists \/model:Test \/db:axmodelstore \/server:axserver<\/pre>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">Solution<\/h2>\r\n\r\n\r\n\r\n<p>So, use Get-AXModel to list the models matching the name you want to delete:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\"><code>get-axmodel -server devsrv1 -database dynamicsax_dev_model -model temp<\/code><\/pre>\r\n\r\n\r\n\r\n<p>Find the ModelId property of the model you want to delete:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">ModelManifestType : AXModelFile\r\n\r\nModelHash         :\r\n\r\nBackingFile       :\r\n\r\nModelFileVersion  : 18\r\n\r\nSchemaVersion     : 1.9\r\n\r\nElementCount      : 2\r\n\r\nModelBuildVersion :\r\n\r\n<strong>ModelId           : 25\r\n<\/strong>\r\nName              : temp\r\n\r\nDisplayName       : temp\r\n\r\nDescription       :\r\n\r\nPublisher         :\r\n\r\nSigned            : False\r\n\r\nCategory          : Standard\r\n\r\nInstallMode       : Standard\r\n\r\nVersion           : 1.0.0.0\r\n\r\nLayer             : Usr\r\n\r\nDependencyState   :\r\n\r\nDetails           :<\/pre>\r\n\r\n\r\n\r\n<p>To remove that specific model, just pass the model ID to the -Model parameter of Uninstall-AXModel:<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\"><code>uninstall-axmodel -server devsrv1 -database dynamicsax_dev_model -model 25<\/code><\/pre>\r\n","protected":false},"excerpt":{"rendered":"<p>Recently I came across a situation where I had multiple models with the same name in one of the AX 2012 instances I am developing for. It is possible to do this through the AX developer workspace as long as they have different publishers, but it causes the model management Powershell cmdlets to freak out &hellip; <a href=\"https:\/\/www.bakke.online\/index.php\/2019\/10\/30\/dynamics-ax-2012-managing-duplicate-model-names\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Dynamics AX 2012 &#8211; Managing duplicate model names&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[2,3],"class_list":["post-1352","post","type-post","status-publish","format-standard","hentry","category-dynamics-ax","tag-ax2012r3","tag-dynamics-ax"],"_links":{"self":[{"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/posts\/1352","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/comments?post=1352"}],"version-history":[{"count":5,"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/posts\/1352\/revisions"}],"predecessor-version":[{"id":1359,"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/posts\/1352\/revisions\/1359"}],"wp:attachment":[{"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/media?parent=1352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/categories?post=1352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/tags?post=1352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}