Skip to main content

Update Extension (App)

The script imports the Microsoft.Dynamics.Nav.Apps.Management.dll module, which provides the cmdlets that are used to manage apps.

info

Before running the script please fill out the variables

  • $NSTFolderPath: the path to the folder containing the Microsoft Dynamics 365 Business Central server instance
  • $ServerInstance: the name of the Business Central server instance
  • $AppName: the name of the extension you want to update
  • $OldVersion: the version number of the old version of the extension
  • $NewVersion: the version number of the new version of the extension
  • $NewAppPath: the path of the .app file for the new version of the extension

It's worth mentioning that the script should be run on the same machine as the Business Central Server Instance or the server instance should be reachable using the specified name.

warning

If you need to perform a ForceSync when performing synchronization of the extension use the script at ForceSync

And also, the script assumes that the user running the script has the necessary permissions to perform the above actions.

Please make sure that the variables are set correctly before running the script and that you have the correct version of the app package and that the path to the package is valid.

#-------------------------------PRE STEP-------------------------------
$NSTFolderPath = "";
$ServerInstance = "";
$AppName = "";
$OldVersion = "";
$NewVersion = ""; #Format: #.#.#.#
$NewAppPath = "";
#-------------------------------DO NOT EDIT UNDER THIS LINE-------------------------------
Import-Module (Join-Path $NSTFolderPath "Microsoft.Dynamics.Nav.Apps.Management.dll");

Uninstall-NAVApp -ServerInstance $ServerInstance -Name $AppName -Version $OldVersion -Force;

Publish-NAVApp -ServerInstance $ServerInstance -Path $NewAppPath -SkipVerification;
Sync-NAVApp -ServerInstance $ServerInstance -Name $AppName -Version $NewVersion;
Start-NAVAppDataUpgrade -ServerInstance $ServerInstance -Name $AppName -Version $NewVersion;
Install-NAVApp -ServerInstance $ServerInstance -Name $AppName -Version $NewVersion;

Unpublish-NAVApp -ServerInstance $ServerInstance -Name $AppName -Version $OldVersion;