Skip to content
Microsoft Dynamics 365 Blog

Upgrading a Microsoft Dynamics NAV solution is time consuming. You have to identify which changes you have to make, you have to upgrade the application objects and the application code, and you might have to move the existing data around so that it fits the new database schema. In Microsoft Dynamics NAV 2013 R2 Cumulative Update 9, we introduced a new set of Windows PowerShell cmdlets that can help you through the code upgrade. In Microsoft Dynamics NAV 2015, the functionality and sample scripts have been further improved.

You can use the new cmdlets to modify application object source files in the Microsoft Dynamics NAV 2015 Development Shell, or by importing the Microsoft.Dynamics.NAV.Model.Tools.psd1 module into the Windows PowerShell Integrated Scripting Environment (ISE). The new application merge utilities install when you choose the Developer option in Microsoft Dynamics NAV 2015 Setup, or if you add the development environment to another installation option.

The application merge utilities include the following Windows PowerShell cmdlets:

Name

Description

Merge-NAVApplicationObject

Compares the changes that have been made between two sets of Microsoft Dynamics NAV application objects, and applies the difference to a third set of application objects. The result of the merge is a number of text files with the merged application objects. Any conflicts that the cmdlet cannot merge are identified in conflict files.

Compare-NAVApplicationObject

Compares text files that contain Microsoft Dynamics NAV application objects, and then calculates the delta between the two versions. The result of the comparison is a number of text files with the calculated delta.

Update-NAVApplicationObject

Applies a set of deltas to the specified application objects. The files that describe the delta are generated by the Compare-NAVApplicationObject cmdlet.

Join-NAVApplicationObjectFile

Combines multiple application object files into one text file

Split-NAVApplicationObjectFile

Splits a text file that contains two or more application objects into separate text files for each application object.

Get-NAVApplicationObjectProperty

Gets Microsoft Dynamics NAV application object properties from the specified application object text files.

Set-NAVApplicationObjectProperty

Sets Microsoft Dynamics NAV application object properties in the specified application object text files.

Export-NAVApplicationObjectLanguage

Exports captions from the specified text files with Microsoft Dynamics NAV application objects. The captions are exported to text files.

Import-NAVApplicationObjectLanguage

Imports strings in the specified language into text files that contain Microsoft Dynamics NAV application objects.

Join-NAVApplicationObjectLanguageFile

Combines multiple text files with captions for Microsoft Dynamics NAV application objects into one text file.

Remove-NAVApplicationObjectLanguage

Deletes captions in the specified language from Microsoft Dynamics NAV application objects.

Split-NAVApplicationObjectLanguageFile

Splits a text file that contains multilanguage captions for two or more application objects into separate text files for each application object.

Test-NAVApplicationObjectLanguageFile

Tests captions in Microsoft Dynamics NAV application objects to test to validate if they have translated strings for the specified languages.

 Getting started

You can read more about the cmdlets and how to use them in the MSDN Library, but you can also type Get-Help “NAV” in the Windows PowerShell ISE or the Microsoft Dynamics NAV Development Shell.

If you don’t want to use the Microsoft Dynamics NAV Development Shell, use the Windows PowerShell ISE. But before you can access the cmdlets, you must import the Microsoft.Dynamics.Nav.Model.Tools.psd1 module. Here is an example of the command you can type:

Import-Module “${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\80\RoleTailored Client\Microsoft.Dynamics.Nav.Model.Tools.psd1” -force

Get-Help “NAV”

Now you can see the Help for the cmdlets and take a closer look at the examples for how to use them.

Now you can see the Help for the cmdlets and take a closer look at the examples for how to use them. You can also see detailed Help for each cmdlet by typing the following command:

Get-Help cmdletname -detailed

And you can concentrate on the examples by typing the following command:

Get-Help cmdletname -examples

 For all of the new cmdlets, the starting point is 3 versions of application objects that you want to merge. The following table describes the three versions of the Microsoft Dynamics NAV application that you want to compare and merge.

Version

Description

Original

The baseline of the application merge. For example, the Microsoft release of Microsoft Dynamics NAV 2013 R2.

Modified

The updated version of the original. For example, this can be your add-on.

In many cases, the modified application is the version that contains fewer changes to the original than the version that is the target of the merge. This is because you want to apply fewer changes to a large application rather than applying a large change to a small application.

Target

The version of the application that you want to apply the difference between the original and the modified application to. For example, this can be the new major release from Microsoft of Microsoft Dynamics NAV 2015 that you want to apply your modified solution to.

Each of these versions can be any version that you want to do a three-way merge between. ORIGINAL can be your add-on, MODIFIED can be a customization of your add-on, and TARGET can be a new release of Microsoft Dynamics NAV from Microsoft. But for the purposes of this blog post, we’ll keep the definitions as described in the table above.

As input to the cmdlets, you can provide a text file, a list of text files, or a folder with text files. So you need to export the relevant application objects as text files. Optionally, you can use the development environment command ExportObjects. You can export each application object to a separate text file, or you can export all objects to a single text file. Optionally, you can use the Join-NAVApplicationObjectFile and Split-NAVApplicationObjectFile cmdlets to structure the text files in the way that works better for you. Also, depending on your scenario, you can work with a subset of your application, such as all codeunits, objects within an ID range, or a specific group of objects. Use the tools to get the text files that you need, and take a look at the sample scripts for inspiration.

The Windows PowerShell sample scripts are available on the product media. Start by opening the HowTo-Start-Import-NAV-Module.ps1 script in the Windows PowerShell IDE, navigate the command prompt to the folder where you placed the samples, and then run the script. Then open one of the other scripts, such as HowTo-Merge-1-General.ps1, and follow the guidance in the script.

We suggest that you open each of the sample scripts in the Windows PowerShell IDE and read through them to get acquainted with the new cmdlets. Then, set up a small test environment of your own where you can safely use the cmdlets on your own application objects to upgrade your solution to Microsoft Dynamics NAV 2015.

 

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!