DYNAMICS AX 2012 R3 TO DYNAMICS 365 FOR FINANCE AND OPERATION, ENTERPRISE EDITION – CODE UPGRADE
Got the task to migrate the Dynamics AX 2012 code to Dynamics 365 for Finance and Operation, no need to look anywhere else, this blog series will help you to migrate AX 2012 code to Dynamics 365. Although you can find detailed documentation by Microsoft on the upgrade process, I will cover all the basic steps that are needed for code migration in summarized way.
In the first part of this series, we will look into the steps to extract the model store from AX2012 R3 environment, setup and configure VSTS and LCS project. Please note that this upgrade process currently works for Microsoft Dynamics AX 2012 R3 and its all cumulative updates (CUs), so if you want to upgrade AX2012 R2 to Dynamics 365, you first have to update it to R3 and then the code can be migrated to Dynamics 365.
Prerequisites:
Before starting the upgrade process, make sure you have access to following.
- AX 2012 R3 environment with administrator privilege.
- Access to Microsoft Dynamics Lifecycle Services (LCS).
- Access to Visual Studio team services (VSTS).
- Microsoft Dynamics 365 for Finance and Operations development environment (in our case we’ll be using VM deployed on our local machine)
Steps:
1. Export model store file
First step is to export .axmodelstore file from the AX2012 environment. Before exporting, make sure that AX2012 environment contains all of the code on specific model and layer. Use the following command to export .axmodelstore file on Microsoft Dynamics AX Management Shell (Run as administrator).
Export-AXModelStore -File <FileInfo> [-Database <String>] [-Details] [-Server <String>]
For example,
Export-AXModelStore -File c:\DEMO2012Model.axmodelstore -Details -database DynamicsAX_DEMO_model -server DEMO\DEMO2012
After this command is executed, you will find ‘DEMO2012Model.axmodelstore’ file in your C: drive root directory. The size of .axmodelstore file is usually large (in GBs), so we have to compress it (.zip) in order to upload it on LCS. To compress this file, we can use WinRAR or WinZip or any other tool.
2. Setup VSTS project
Go to https://visualstudio.com and create a free VSTS account. Do remember to use credentials that are linked with your organization (same will be needed for LCS login).
Next, enter your VSTS site (use customer name), choose Team Foundation Version Control option and click Continue.
In our case, VSTS site https://contoso365.visualstudio.com will be created. It contains one default project called: MyFirstproject.
Now we will create a new VSTS project. Click on ‘New Project’, enter project information and click ‘Create’.
3. Create and configure a new LCS project
Now you have to login to LCS and on main screen, click on ‘+’ to create a new LCS project. LCS will then ask what is this project for. Select ‘Migrate, create solutions and learn’.
Provide a name, and select the following values from the next menu and click create.
Next you will see the following screen. Before moving further, we first need to configure the new project with VSTS. Click on ‘Setup Visual Studio Team Services’ button.
Next you will see the following screen, enter VSTS URL that we just created in previous steps and add personal access token. Following link will guide you how to create a personal access token.
Next select the VSTS project that we just created in previous step. Click continue and review and save the changes.
Now you have to authorize LCS project with the VSTS project, on the main project screen, click Authorize.
On the next screen, click Accept. You’ve now successfully configured VSTS project with your LCS project.
In the next part, I will explain the use of code upgrade tool in LCS to migrate your AX2012 code to Dynamics 365.
In the first part of this series, we covered the steps to extract model store file from AX 2012 environment and LCS project creation, configuration and link it with VSTS project. Below is the link of the first part. In this part, we will be moving the AX2012 code to Dynamics 365 environment.
Before starting, it is important to note that this code upgrade process uses overlayering approach to upgrade the code. Overlayering is a traditional approach which is common in earlier AX versions but for Dynamics 365, its not the best way as it needs more time and effort to resolve conflicts and perform testing for future releases and upgrades. The alternate method is to use extension approach which allows existing objects to be customized without directly touching the original object. For this blog series, we will create extension for overlayered code and elements.
Steps:
1. Using code upgrade tool in LCS
This process converts an export of AX 2012 model store to the correct format for Finance and Operations. During this, it also directly resolves some types of conflict issues but for other issues that it can’t resolves by itself, it log those in Microsoft Visual Studio Team Services (VSTS) tasks. Some reports are also generated after the process completes that provides the user list of conflicts and migration summary.
Now let’s start this process. In your LCS project, select the Code upgrade tile.
In the bottom left corner of the screen, click Add, and then enter a name and description. Select source and target version, and then click Create.
Next, click on ‘Add files’. You will be prompted to upload a zipped version of your Dynamics AX 2012 R3 model store file. Once the uploading is finished, Click Analyze code in the bottom right corner. The code upgrade process will start. This typically takes 60-90 minutes depending on the size of you model store file. When complete, return to the Code upgrade tile in LCS to view the results.
2. Analyzing code upgrade process results
The process provides following files.
- Upgraded metadata zip file: This is the upgraded source code file for Dynamics 365, contains xml files for all the AOT elements, can be used for manual code merge without using TFS.
- AX7 metadata version: This contains the Dynamics AX version number that the code was upgraded against.
- Migration Summary: The migration summary file enlists elements that are successfully upgraded (via extension or overlayering) or that have conflicts that need to be resolved manually.
- Tasklist: The task list report contains element wise list of conflicts that need to be resolved. It also provides the approximate number of estimate hours required to resolve each conflict.
3. Development environment
Now let’s head over to the development environment. We have already downloaded and configured D365FO VM (Version 7.3 Platform Update 12) on our local machine. On the VM, let’s open Visual Studio (Run as Administrator) to begin the development.
First, we need to add the account that is linked to VSTS. Open account settings (File > Account Settings) and click add an account. Enter the credentials on the next screen and click Finish.
Next, open Team Explorer (View>Team Explorer) and click Connect.
On the next window, click on Servers button. Click Add on next screen. Enter VSTS URL on which we have created a VSTS project (in the first part of this series). Once you click OK, you will be asked to select the account linked with VSTS.
Next, select the project that we’ve created earlier. In our case its ‘D365 Code upgrade’ project.
Now that we have connected to TFS, let’s configure the workspace to sync metadata and projects.
Click Configure your workspace on Team Explorer.
Map Trunk>Main>Metadata and Trunk>Main>Projects node to the following directories and click OK.
Next, you will see the following message. When you click ‘Yes’, VSTS project files will be downloaded to your VM. This will take some time.
Once completed, if you browse through the projects that the process created, you will find these three types of projects.
- CodeMergeSolution: You will have to merge your code with the new code in this project.
- UnParsableSolution: There are some AX2012 elements that are not supported in D365 (like AIF), this solution contains those elements and code that needs to be rewritten.
- UpgradedSolution: Some of the code is automatically upgraded by Microsoft, contain all elements that are upgraded automatically.
If you now open the AOT, you will see some new models that are now added. In the next blog, we will learn how we can resolve the conflicts and create extensions of the code and elements that are overlayered.
Comments
Post a Comment