Export (0) Print
Expand All

Code Upgrade Tool User Guide [AX 2012]

Updated: November 28, 2011

Applies To: Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

The Code Upgrade Tool for Microsoft Dynamics AX 2012 (Beta) is designed to help Microsoft Dynamics AX developers upgrade their X++ code to Microsoft Dynamics AX 2012. The tool analyzes X++ code patterns. The tool then automatically fixes some patterns, provides suggestions for how to fix other patterns, and categorizes upgrade tasks. Developers can also add their own patterns for analysis.

The Code Upgrade Tool is available from the InformationSource services download page.

We recommend that developers who upgrade X++ code to Microsoft Dynamics AX 2012 use the Code Upgrade Tool. The tool includes approximately 50 patterns that can be used to upgrade code from Microsoft Dynamics AX 2009 to Microsoft Dynamics AX 2012. The tool is fully extensible, so that partners and customers can add patterns to the tool.

The tool provides the following benefits:

  • The tool automatically fixes code, so that less manual work is required.

  • The tool provides suggestions to help you fix code patterns more quickly.

  • The tool segments upgrade tasks by category.

  • The tool is extensible, so that you can add new patterns.

This section describes the tasks that you must complete to install the Code Upgrade Tool.

  1. Create a folder to put the files in.

    NoteNote

    You cannot create a folder when you extract the files. You must select an existing folder.

  2. Extract the files.

The following table shows the four DLLs that you must put in the Client\bin folder for Microsoft Dynamics AX. For example, this folder may be located at C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin.

Name

Description

Microsoft.Dynamics.AX.Framework.Xlnt.Pass2.dll

An assembly for the Code Upgrade Tool

Microsoft.Dynamics.AX.Framework.Xlnt.ParserInCS.dll

An assembly for the Code Upgrade Tool

Microsoft.Dynamics.AX.Tools.CodeUpgradeTool.Rules.dll

An assembly that contains the rules for Microsoft code upgrade patterns

Microsoft.Dynamics.AX.Tools.CodeUpgradeTool.AssemblyReader.dll

An assembly for the Code Upgrade Tool

  1. Import the XLNT Model.axmodel and Code Upgrade Tool Model.axmodel files by using Windows PowerShell or AXUtil.

    NoteNote

    If you reinstall the model files later, the installation may fail because of a conflict. We recommend that you use the -ConflictPush option to push the model that has the conflict to the update layer, and then resolve the conflict. For more information, see How to: Export and Import a Model and How to: Resolve Conflicts After Importing a Model.

  2. Restart Application Object Server (AOS).

  3. Start the Microsoft Dynamics AX client.

  4. When you start the client, you receive the following message: "The model store has been modified." Select Compile and synchronize.

  5. In the Application Object Tree (AOT), in the Forms node, open the SysCompilerSetup form. Change the Output value to Message window.

  6. Go to Tools > Model Management > Create project from model. Build projects from the XLNT and Code upgrade models.

  7. Compile the XLNT project first, and then compile the Code upgrade project.

  8. Go to Tools > Code upgrade > Import code upgrade rules.

  9. Click Browse, and then select Microsoft.Dynamics.AX.Tools.CodeUpgradeTool.Rules.dll. Typically, this DLL is located in Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin.

  10. Click Import rules. After the rules have been imported, close the form.

  11. In the AOT, in the Forms node, open the SysCompilerSetup form. Change the Output value to Form.

  12. Restart the Microsoft Dynamics AX client.

  13. Go to Tools > Options. On the Development tab, click Code upgrade check. In the Code upgrade check form, select the category of rules to run.

    The following table describes the categories of rules.

    Category

    Description

    AddressBook

    Rules that are related to adoption of the updated address book framework for Microsoft Dynamics AX 2012

    Formletter

    Rules that are related to adoption of the updated form letter framework for Microsoft Dynamics AX 2012

    IDGoAway

    Rules that are related to adoption of the updated type IDs

    Inventory

    Rules that are related to adoption of the updated inventory refactoring in Microsoft Dynamics AX 2012

    Number sequence framework

    Rules that are related to adoption of the updated number sequence framework for Microsoft Dynamics AX 2012

    XppComplier

    Rules that are related to adoption of compiler changes.

You may want to experiment with the types of errors that the tool can identify and fix, and the types of errors that the tool can only identify. Therefore, the tool includes two examples of classes that have errors that you can experiment with:

  • PipelinableMutator contains errors that the tool can identify and fix.

  • PipelinableSweeper contains errors that the tool can identify, but that it cannot fix.

ImportantImportant

After you import .xpo files or add code, we recommend that you restart the client and compile code before you run the tool. If you do not restart the client and compile code, the tool may not detect patterns correctly.

  1. In the AOT, select any method in the Table or Class node, right-click Add-Ins, and then select Check Code upgrade patterns.

    When the tool starts, a list of white papers about code upgrades is displayed. You can select a check box to skip this page.

    If patterns or rules exist, the Compiler window displays the number of patterns and rows that were found, and descriptions of the patterns and rows.

  2. If a rule can be fixed automatically, the Automatically Fixable column in the Compiler Output window contains Yes.

  3. If you have to fix a rule, click Fix upgrade pattern to see the actual fix and the suggested fix.

  4. To fix a rule, select either Fix method or Fix all methods.

The package that you expanded contains two additional self-extracting ZIP files:

  • CodeUpgradetool.Rules – This file contains code for the predefined rules. You can use this file for reference, or you can modify it.

  • CodeUpgradetool.Rules.Partner – This file contains an empty template that you can use to create new rules.

Follow these steps to extend the tool.

  1. Create folders, and then extract the files from CodeUpgradetool.Rules and CodeUpgradetool.Rules.Partner.

  2. Add a new .cs file to the Microsoft.Dynamics.AX.XLNT.Rules project.

  3. Update references to the following DLLs. References must use the path that you extracted the project to in Client\Bin.

    • Microsoft.Dynamics.AX.Framework.Xlnt.XppParser.dll

    • Microsoft.Dynamics.AX.Framework.Xlnt.XppParser.Pass2.dll

  4. Create a file in the Partners folder.

  5. Add the following attributes to the class:

    • Author – The author of the file.

    • Description – A description of the rule.

    • AutomaticallyFixable – Set this attribute to "Yes" if the rule can be fixed automatically. Otherwise, set the attribute to "No".

    • Category – The category of the rule.

    • Version – The upgrade version, such as 2009 > 2012.

  6. Save and build the project. We recommend that you name the project Microsoft.Dynamics.AX.Tools.CodeUpgradetool.Partner.dll.

  7. Put the output DLL in the bin\Debug folder.

  8. Copy the DLL to MicrosoftDynamicsAx\Client\Bin.

  9. In the AOT, add a reference to the DLL under References.

  10. Go to Forms > XLNT Rules, and then click Browse. Locate Microsoft.Dynamics.AX.Tools.CodeUpgradeTool.Rules.dll, and then click Import rules.

  11. The new rules are added.

  1. In the AOT, in the Forms node, open the SysCompilerSetup form. Change the Output value to Message.

  2. Use Windows PowerShell or AXUtil to remove the models that were imported. For more information, see How to: Remove (Uninstall) a Model.

    Caution noteCaution

    If you delete a model or a layer, you can cause significant loss of business data, and also loss of metadata. When you run a command to delete a model, we recommend that you use the -Details or /verbose parameter to list the elements that may be deleted. In this manner, you can determine the effect of the deletion on your environment.

    • Business data may be lost if the database schema is changed. The database schema is changed when tables or fields are removed.

    • Element IDs may be lost. If element IDs are lost, existing business data may become invalid.

    • Orphaned metadata elements in other models or layers are deleted.

  3. Restart AOS.

  4. Start the Microsoft Dynamics AX client, and perform a complete compilation and synchronization.

  5. In the AOT, in the Forms node, open the SysCompilerSetup form. Change the Output value to Form.

Send feedback about the tool, and new patterns that you want to see included in the tool, to the following address:

Code Upgrade Tool Partner Feedback: cutpf@microsoft.com


Announcements: To see known issues and recent fixes, use Issue search in Microsoft Dynamics Lifecycle Services (LCS).
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft