AX7 – Resolve Code Conflict (Merge)

When you upgrade to The New Microsoft Dynamixs AX or perform a code upgrade to a newer version of AX7 it’s very likely you have to resolve code conflicts. Here’s one possible way to organize and do the merge.

Work items

The Code Upgrade Service created a list of work items in VSTS (Visual Studio Team Services) for you. If you have to resolve conflicts you’ll find one task per conflict there. Not all work items that were created target conflicts! It might be a good idea to use that list to allocate the work to be done. We use a system of pulling by assigning ourselves to the next free task and setting it to In Progress.
VSTS All Work

View and solve Conflicts

You could use the generated solutions for Visual Studio that were built up by the Code Upgrade Service – they’re located in the Projects folder of the branch that was created.
We don’t… I usually navigate to the object I have to modify by copying the name of the object from the task’s headline to the Application Explorer’s filter area.

AX7 Filter To Object Name
Next you can move it to a project in Solution Explorer or start modifying it right away. In case of a conflict the object already is in a model of yours and therefore this would be fine. Personally, I would always suggest to use a project (which forcibly belongs to exactly one model) to keep things clear. To be able to solve a conflict you need to open the designer view (instead of the code). If you’re in the code view already the shortest way to open the designer view is to right-click anywhere in the code and choose Open Designer. You might face that situation often when you work with classes – they open the code view by default when you double-click them in Solution Explorer – unlike all other object types.

Open Designer From Code

You can see that there is a conflict on the object in Solution Explorer as well as in the header bar of the designer view – the object name is extended by [!].
If there are conflicts you can filter the object view to only the conflicts by typing cf: in the Search … field at the top.
To resolve a single conflict – you have to do them one by one if there are more than one – right click the conflicting node (it is marked with red arrows pointing at each other) and choose Resolve code conflicts ….

Designer Conflicts Only Resolve

What you’ll get then is a three-way-merge view including the new standard code on the left, the old modified code on the right and the result at the bottom. Code that is marked with green background color was solved automatically, the orange parts need to be solved manually. You can select one or the other (or both) by using the checkbox(es) left of the code. You can also type directly in the result window at the bottom.

AX7 Three Way Merge

When you leave the view or save the object with Ctrl+S you are asked if the conflict was solved. If you confirm that the arrow sign disappears. If all conflicts are solved and the object gets saved the exclamation mark disappears as well, indicating the object has no open conflicts anymore.

Remove customization

In the example you can see in the screenshots the merge led to a situation in which I didn’t need the object to be customized anymore at all. To delete an object from a model you need to delete it from the project in Solution Explorer that belongs to that model. From a version control’s perspective you’ll get a pending delete (instead of the pending change that was there before) accordingly.

Delete Customization

2 thoughts on “AX7 – Resolve Code Conflict (Merge)

  1. Thanks for sharing…

    How to resolve conflicts in Report as i didn’t see the option “resolve conflicts”. please help.

    • Well, reports and conflicts after upgrades are an issue ever since. The reason is that rdl (the xml format SSRS reports are composed of) isn’t really made for that. I guess because of that you don’t see an option for this.
      Since at that point we do not carry on changes to SSRS reports that need to be merged I have no experience with that case. I’m sorry I can’t give you a better answer this time. Of course you are very welcome to share your experience after you progressed with that.

Leave a Comment