FrameworkTemplate/SolutionTemplate/Scripts/PreUpgrade.ps1

<#
.SYNOPSIS
    Executes pre-upgrade actions before a solution upgrade is applied to the target environment.
 
.DESCRIPTION
    This script runs automatically before the solution upgrade process begins.
    Use this to perform pre-upgrade operations like backing up data or deactivating processes.
 
.PARAMETER Conn
    The connection object to the Dataverse environment.
 
.PARAMETER EnvironmentName
    The name of the target environment where the solution upgrade will be applied.
 
.PARAMETER Path
    The file path to the solution package.
#>

Param(
    [System.Object] [Parameter(Mandatory = $true)] $Conn,
    [string] [Parameter(Mandatory = $true)] $EnvironmentName,
    [string] [Parameter(Mandatory = $true)] $Path
)

$ProgressPreference = 'SilentlyContinue'
. (Join-Path $PSScriptRoot "DeploymentFunctions.ps1")

Write-Host "Executing Pre Upgrade Action for environment: $EnvironmentName"
Write-Host "Solution Path: $Path"

# Add your custom pre-upgrade logic here