Demystifying re-installation process for Business Central Apps. With uninstall
This is the fourth blog post on series.
The beginning is here:
- Demystifying installation process
- Demystifying upgrade process
- Demystifying re-installation process, without uninstalling
...In the previous series
We ended up with the summary: what's going on during the re-installation of the app (without uninstallation)
- Upgrade codeunit was not triggered
- Install codeunit was triggered
- Not possible for Online Business Central Production Tenant
The result of this scenario can be displayed in the next picture
Figure 1. Re-install without uninstallation
Re-installing App
Option 2: With uninstallation, without unpublishing
Container Sandbox
There is no built-in way, how to uninstall an app from VSCode. So we need to use Powershell for that. The easiest way, to use navcontainerhelper module.
You can create a .ps1 file in VSCode project directory, install PowerShell extension for VSCode and you are ready to run commands.
First, install navcontainerhelper module. If you have it installed, skip this step.
install-module navcontainerhelper -force
Second, uninstall a currently installed version of our app
UnInstall-NavContainerApp -containerName $containername ` -tenant $tenant ` -appName $appname
Note! Data will not be removed. It will be saved, waiting for next install or upgrade. To completely remove data you can
- Re-install container, using
Remove-NavContainer $containername
- Use Clean-CustomNAVAppsOnDocker described in Waldo's post
There are no any uninstallation triggers available. But, they could be valuable, for example, to remove My notifications records, or configuration packages or any other app-related data stored in standard tables. There is a GitHub request on that feature, so crossing fingers to have that soon.
I will save data, just to track the installation log.
Third, install the app once again, using VSCode
VSCode > AL:Publish without debugging (Ctrl+F5)
or Powershell command
Install-NavContainerApp -containerName $containername ` -tenant $tenant ` -appName $appname
Let's look at the installation log.
Online Sandbox
>Web client > Extensions Page > Uninstall >Web client > Extensions Page > Install
or
>Web client > Extensions Page > Uninstall VSCode > AL:Publish without debugging (Ctrl+F5)
Online Business Central Production Tenant
>Web client > Extensions Page > Uninstall >Web client > Extensions Page > Install
Summary
- Upgrade codeunit was not triggered
- Install codeunit was triggered
The result of this scenario can be displayed in the next picture
Figure 2. Re-install with uninstallation, without unpublishing
Option 3: With uninstallation, with unpublishing
Container Sandbox
Uninstall and unpublish currently installed version of our app using Powershell (and navcontainerhelper module)
UnPublish-NavContainerApp -containerName $containername ` -appName $appname ` -unInstall ` -version $version ` -tenant $tenant
Publish and install the same version of an app using Powershell
Publish-NavContainerApp -containerName $containername ` -appFile $appfilename ` -install ` -skipVerification ` -sync ` -tenant $tenant
or VSCode
VSCode > AL:Publish without debugging (Ctrl+F5)
Let's look at the installation log.
Online Sandbox
>Web client > Extensions Page > Uninstall >Web client > Extensions Page > Unpublish
VSCode > AL:Publish without debugging (Ctrl+F5)
Online Business Central Production Tenant
>Web client > Extensions Page > Uninstall >Web client > Extensions Page > Unpublish
>Web client > Extensions Page >Upload .app file
Not possible. When you try to upload the same version of the app to the Online Production Business Central tenant you receive an error
Summary
- Upgrade codeunit was not triggered
- Install codeunit was triggered
- Not possible for Online Business Central Production Tenant
The result of this scenario can be displayed in the next picture
Figure 2. Re-install with uninstallation, with unpublishing
What's next
Next will be the final blog in the series. Stay tuned.
*This post is locked for comments