How to get the version of an app, bundle on macOs

from Beatrix Willius and Tim Parnell

Public Function BundleVersion(fTarget as FolderItem) As String
  // This function does not error trap nil objects because that's some failure you need to debug.
  var oCFURL as CFURLMBS = NewCFURLMBSFile(fTarget)
  if not oCFURL.IsPackage.Value then
    var ex as new UnsupportedFormatException
    ex.Message = fTarget.Name + " is not a bundle."
    raise ex
  var oCFBundle as CFBundleMBS = CreateBundleMBS(oCFURL)
  var oValue as CFObjectMBS = oCFBundle.GetValueForInfoDictionaryKey(CFBundleMBS.kCFBundleVersionKey)
  if oValue isa CFStringMBS then
    var sVersion as String = CFStringMBS(oValue).DisplayString
    return sVersion
End Function

source january 23