Redigera

Dela via


Merging application objects using the example scripts

The Business Central product media includes a folder with examples of how you can use Windows PowerShell cmdlets to compare and merge application objects. In the WindowsPowerShellScripts folder on the product media, the ApplicationMergeUtilities folder contains Windows PowerShell sample scripts and folders that contain demonstration data.

You can run the sample scripts from the Dynamics NAV Development Shell. Alternatively, you can use the Windows PowerShell Integrated Scripting Environment (ISE) as described in the following section.

The individual scripts provide different variations of how you can use the Business Central cmdlets. For example, the HowTo-Merge-N-Conflicts-External-Tools.ps1 script shows different ways of displaying conflicts. By opening the scripts in the Windows PowerShell ISE, you can examine the different variations and decide how you want to use the cmdlets to upgrade and maintain your own application.

Using the sample scripts in the Windows PowerShell ISE

If you want to use the Windows PowerShell ISE, you must import the Microsoft.Dynamics.Nav.Model.Tools.psd1 module. The module installs to the equivalent of C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\NNN\RoleTailored Client when you choose the Developer option in Business Central Setup.

For example, you can import the module into the Windows PowerShell ISE by typing a command as follows:

Import-Module "${env:ProgramFiles(x86)}\Microsoft Dynamics 365 Business Central\140\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.

The ApplicationMergeUtilities folder contains four subfolders that can help you start working with the scripts. The demonstration data in the ORIGINAL, MODIFIED, and TARGET folders illustrate the text files that are the input to the cmdlets. The demonstration data uses separate text files for each application object, but you can configure the text files in the way that works better for you. For example, you can use the Join-NAVApplicationObjectFile cmdlet to combine all the text files in the MODIFIED folder in a single file, for example, before you run the script.

The HowTo-Start-Import-NAV-Module.ps1 script imports the Microsoft.Dynamics.Nav.Model.Tools.psd1 module into the Windows PowerShell ISE. The __Run-Application-Merge-Utilities.ps1 and __Reset-HowTo-Sample.ps1 scripts enable you to run the sample scripts repeatedly.

For Help for a Business Central cmdlet, type Get-Help <cmd name>. For Help for the Windows PowerShell ISE, select F1, or choose the Help menu, and then choose Windows PowerShell ISE Help.

See also

Business Central PowerShell Cmdlets
Merge Application Changes
Comparing and Merging Application Object Source Files