How can I update the old packages (created with an older version of AppDeploy)?

Hello,

I would like to know how I can update packages created with an older version of AppDeploy (Ex : 4.0.6), considering the following context in my company:

Creating a package requires a long process with many tests and validations, which takes at least 2 weeks (banking environment).

So my question is the following:
How can I automatically update packages created with an older version of AppDeploy, without having to recreate them entirely?

Do you have a solution to avoid having to recreate the packages made with an older version of AppDeploy?
Solution methode ? etc. ?

Thx for helps :smile:

The process I'd follow, would be:

Install-Module -Name PSAppDeployToolkit -Scope CurrentUser
Import-Module PSAppDeployToolkit
# Replace Destination with where you want the package, replace AppName with the Application folder name for the app you are re-packaging
New-ADTTemplate -Destination 'C:\Temp' -Name 'AppName' -Show

Then use a comparison tool such as Beyond Compare or WinMerge to compare your current Invoke-AppDeployToolkit.ps1 with the new one created above (If you didn't modify the Destination or AppName then it would be here: C:\Temp\AppName\Invoke-AppDeployToolkit.ps1)
You should be able to copy over any of your customised lines from your 4.0.6 script to the new Blank Template, but you will need to exclude the DeployAppScriptVersion on line 112 (This needs to be the same as the new PSADT version you are migrating to use)

    # Script variables.
    DeployAppScriptFriendlyName = $MyInvocation.MyCommand.Name
    DeployAppScriptParameters = $PSBoundParameters
    DeployAppScriptVersion = '4.1.7'

and this block towards the end of the script (which imports the current (4.1.7) version):

# Import the module and instantiate a new session.
try
{
    # Import the module locally if available, otherwise try to find it from PSModulePath.
    if (Test-Path -LiteralPath "$PSScriptRoot\PSAppDeployToolkit\PSAppDeployToolkit.psd1" -PathType Leaf)
    {
        Get-ChildItem -LiteralPath "$PSScriptRoot\PSAppDeployToolkit" -Recurse -File | Unblock-File -ErrorAction Ignore
        Import-Module -FullyQualifiedName @{ ModuleName = "$PSScriptRoot\PSAppDeployToolkit\PSAppDeployToolkit.psd1"; Guid = '8c3c366b-8606-4576-9f2d-4051144f7ca2'; ModuleVersion = '4.1.7' } -Force
    }
    else
    {
        Import-Module -FullyQualifiedName @{ ModuleName = 'PSAppDeployToolkit'; Guid = '8c3c366b-8606-4576-9f2d-4051144f7ca2'; ModuleVersion = '4.1.7' } -Force
    }

    # Open a new deployment session, replacing $adtSession with a DeploymentSession.
    $iadtParams = Get-ADTBoundParametersAndDefaultValues -Invocation $MyInvocation
    $adtSession = Remove-ADTHashtableNullOrEmptyValues -Hashtable $adtSession
    $adtSession = Open-ADTSession @adtSession @iadtParams -PassThru
}
catch
...

FYI: In my packaging scripts I define which version of PSADT the script uses and pulls in the appropriate version of PSADT during packaging. Only once I have updated the templated version of Invoke-AppDeployToolkit.ps1 for my App to a newer PSADT version do I update my packaging script, this allows me to update each app to a newer version on my cadence.

2 Likes

The transition from 4.1 to a further minor version is really simple, as very little has changed (I wrote an article about this, which, although written in Italian, is easy to understand and can be easily translated): PSADT: migrare facilmente da 4.1.5 a 4.1.7

However, a few things have changed between 4.0 and 4.1, so it's best to think carefully and migrate with caution.

Hello,
thank you all for your replies. I considered encapsulating and indeed centralizing the AppDeploy engine (as mentioned in your examples). Thank you very much for your help.

For what it's worth, the changes we made into 4.1 which made it a bit harder to update won't be repeated. They were things we wanted to correct for the sake of the project's longevity. Unless otherwise specified, you should be able to take a 4.1.x script and run it on 4.5.2 when we release it in 2029 or so.

2 Likes