Saturday, January 5, 2013

Code merging and Object conflicts - Developer's nightmare !!!


 
I will try to explain the problem and solution using some scenario.

Existing system: AX 2012 CU2 + 4 ISVs + 20 Hotfixes + VAR layer + CUS layer + Data for masters and financials 

Proposed changes: Upgrade system to CU3 + Data for masters and financials 

Steps performed:
  • Installed CU3 on base system
  • Installed ISVs layer code [Upgraded code provided by ISV]
  • Installed VAR layer code [To be upgraded by you]
  • Created a new merge model in VAR layer and worked on code upgradation
  • Installed CUS layer code [Upgraded code provided by CUS]
  • Created a new merge model in CUS layer and worked on code upgradation 
Code upgraded by this step. Next step is to use the upgraded code with the existing data created by team. 
  • Exported the axmodelstore for the upgraded code
  • Created a new database and restored the previous version's existing data.
  • Attached this database to AX 2012 and imported the axmodelstore in to it.
  • Encountered hundreds of conflicts and could not proceed. We can proceed in this case but will lose the data for all the conflicting objects [Fields and Tables] 


We end up in a deadlock on what went wrong and why we encountered so many conflicts. After analyzing all the steps, below are the refined steps: 
  • Export the axmodelstore from the previous latest build
  • Create a new database
  • Install the axmodelstore on the new database
  • Install CU3 on this
  • Install ISVs layer code [Upgraded code provided by ISV] using REPLACE command as shown below: 
Axutil import /file:C:\XYZ\FilePath\FileName.axmodel /replace:41 /conflict:overwrite 
  • Install VAR layer code [To be upgraded by you] using REPLACE command
  • Create a new merge model in VAR layer and work on code upgradation OR Use the existing VAR merge model [if already performed above steps] created above which can be reused and can save effort
  • Install CUS layer code [Upgraded code provided by CUS] using REPLACE command 
  • Create a new merge model in CUS layer and work on code upgradation OR Use the existing CUS merge model [if already performed above steps] created above which can be reused and can save effort
  • Export out the upgraded axmodelstore 
  • Create a new database 
  • Import existing data from previous build on it 
  • Install the axmodelstore on it and you should not get code conflicts [Or minimum conflicts will be encountered]
This is the clean process to perform the code upgrade and retain the data from previous version.

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete