Demystifying re-installation process for Business Central Apps. With uninstall

This is the fourth blog post on series.

The beginning is here: 

…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

image

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

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.

image

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 
image

Let’s look at the installation log.

image

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)
image

Online Business Central Production Tenant

>Web client > Extensions Page > Uninstall
>Web client > Extensions Page > Install
image

Summary

  • Upgrade codeunit was not triggered
  • Install codeunit was triggered

The result of this scenario can be displayed in the next picture

image

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 
image

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.

image

Online Sandbox

>Web client > Extensions Page > Uninstall
>Web client > Extensions Page > Unpublish
VSCode > AL:Publish without debugging (Ctrl+F5)
image

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 

image

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

image

Figure 2. Re-install with uninstallation, with unpublishing

What’s next

Next will be the final blog in the series. Stay tuned.

Share Post:

Leave a Reply

About Me

DMITRY KATSON

A Microsoft MVP, Business Central architect and a project manager, blogger and a speaker, husband and a twice a father. With more than 15 years in business, I went from developer to company owner. Having a great team, still love to put my hands on code and create AI powered Business Central Apps that just works.

Follow Me

Recent Posts

Tags