navcontainerhelper icon indicating copy to clipboard operation
navcontainerhelper copied to clipboard

Compile-AppWithBcCompilerFolder, ALTool returns dependencies.appId for older apps

Open MODUSCarstenScholling opened this issue 4 months ago • 3 comments

Describe the issue Compile-AppWithBcCompilerFolder, ALTool returns dependencies.appId for older apps instead of dependencies.id. I have an example from May 2022, a third party app I cannot change.

I cannot say if this is expected from ALTool or a problem there. However, it causes errors when Compile-AppWithBcCompilerFolder is used.

Partial output of scripts

[...]
BcContainerHelper version 6.0.25
BC.HelperFunctions emits usage statistics telemetry to Microsoft
[...]
Getting .app info C:\BuildAgents\MC21\_work\2406\s\.alpackages-8cbe5d9a-64e8-4ad1-b059-fbd52596ae47\cache_AppInfo.json
- Kies Systems GmbH_KS Mobility Suite_21.4.34.0_app.appCompile-AppWithBcCompilerFolder Telemetry Correlation Id: 7f255564-d58b-4fea-b84b-40b6cf5b3b9c
The property 'id' cannot be found on this object. Verify that the property exists. at <ScriptBlock>, C:\Users\mc\Documents\PowerShell\Modules\BcContainerHelper\6.0.24\HelperFunctions.ps1: line 1127
at GetAppInfo, C:\Users\mc\Documents\PowerShell\Modules\BcContainerHelper\6.0.24\HelperFunctions.ps1: line 1127
at Compile-AppWithBcCompilerFolder, C:\Users\mc\Documents\PowerShell\Modules\BcContainerHelper\6.0.24\CompilerFolderHandling\Compile-AppWithBcCompilerFolder.ps1: line 181
at <ScriptBlock>, C:\BcBuild\MC21\execute.ps1: line 1148
at <ScriptBlock>, C:\BcBuild\MC21\execute.ps1: line 1143
at <ScriptBlock>, C:\BcBuild\MC21\execute.ps1: line 782
at <ScriptBlock>, C:\BuildAgents\MC21\_work\_temp\7e677b82-2222-4535-aacf-3ab843a67a87.ps1: line 4
at <ScriptBlock>, <No file>: line 1
##[error]ForEach-Object : The property 'id' cannot be found on this object. Verify that the property exists.
At C:\Users\mc\Documents\PowerShell\Modules\BcContainerHelper\6.0.24\HelperFunctions.ps1:1127 char:136
[...]

Working, compiled in October 2024

{
  "id": "ba5e92a6-b5c1-471d-ad51-1f407e627c27",
[...]
  "runtime": "13.0",
  "target": "Cloud",
  "application": "24.3.0.0",
  "platform": "24.0.0.0",
[...]
  "dependencies": [
    {
      "id": "d78da1d4-e45e-479e-9bb3-c368752fb48f",
      "name": "MODUS M365 Foundation",
      "version": "24.1.24082101.24082101",
      "publisher": "MODUS Consult GmbH"
    }
  ],
[...]
  "build": {
    "by": "AL Language Extension,15.0.1143290",
    "timestamp": "2024-10-01T14:09:57.9681148+02:00",
    "compilerVersion": "15.0.17.29212"
  }
}

NOT working, compiled in May 2022

{
  "id": "99c768dc-ae71-4385-97e8-bcc928d13c64",
  "runtime": "3.0",
  "target": "Internal",
  "application": "14.0.0.0",
  "platform": "14.0.0.0",
[...]
  "dependencies": [
    {
      "appId": "04d84083-a4ae-4051-b22b-5483a70bb119",
      "name": "KS Version Handling",
      "version": "14.0.0.3",
      "publisher": "Kies Systems GmbH"
    }
  ],
[...]
}

Original code in HelperFunctions.ps1

                if ($alToolExists) {
                    $arguments = @('GetPackageManifest', """$path""")
                    if ($alToolDll) {
                        $arguments = @($alToolDll) + $arguments
                    }
                    $manifest = CmdDo -Command $command -arguments $arguments -returnValue -silent | ConvertFrom-Json
                    $appInfo = @{
                        "appId"                 = $manifest.id
                        "publisher"             = $manifest.publisher
                        "name"                  = $manifest.name
                        "version"               = $manifest.version
                        "application"           = "$(if($manifest.PSObject.Properties.Name -eq 'application'){$manifest.application})"
                        "platform"              = "$(if($manifest.PSObject.Properties.Name -eq 'platform'){$manifest.Platform})"
                        "propagateDependencies" = ($manifest.PSObject.Properties.Name -eq 'PropagateDependencies') -and $manifest.PropagateDependencies
                        "dependencies"          = @(if($manifest.PSObject.Properties.Name -eq 'dependencies'){$manifest.dependencies | ForEach-Object { @{ "id" = $_.id; "name" = $_.name; "publisher" = $_.publisher; "version" = $_.version }}})
                    }
                    Write-Host " (succeeded using altool)"
                }

MODUSCarstenScholling avatar Oct 04 '24 09:10 MODUSCarstenScholling