public static void _outputContainerImageMetadataFile(List <OutputContainerImage> builtImages, bool outputFullMetadataFile) { PublishContainerImages.WriteLog($"\nWriting the following entries to {PublishContainerImages.BuiltImageMetadataFilename}:"); builtImages.Select(x => $"{x.ProdRepoName}:{x.VersionTag}") .ToList().ForEach(PublishContainerImages.WriteLog); var builtImagesFilePath = Path.Combine(OutputImagesTxtFilePath(), PublishContainerImages.BuiltImageMetadataFilename); Directory.CreateDirectory(new FileInfo(builtImagesFilePath).DirectoryName); var imagesWithMetadata = builtImages.Where(im => im.Metadata != null).ToList(); dynamic metaDataOutput = new ExpandoObject(); if (outputFullMetadataFile) { metaDataOutput.imageReferences = ImageReference.GetAllImageReferences(); } metaDataOutput.containerImages = new dynamic[imagesWithMetadata.Count]; int index = 0; foreach (var image in imagesWithMetadata) { dynamic imageEntry = new ExpandoObject(); imageEntry.containerImage = $"{image.ProdRepoName}:{image.VersionTag}"; imageEntry.os = image.Metadata.Os; imageEntry.app = image.Metadata.App; imageEntry.appVersion = image.Metadata.AppVersion; imageEntry.renderer = image.Metadata.Renderer; imageEntry.rendererVersion = image.Metadata.RendererVersion; imageEntry.imageReferenceId = image.Metadata.ImageReferenceId; metaDataOutput.containerImages[index++] = imageEntry; } string metadataJson = Json.JsonSerializeObject(metaDataOutput); File.WriteAllText(builtImagesFilePath, metadataJson); PublishContainerImages.WriteLog($"\nWrote metadata file at: {builtImagesFilePath}, file contents:"); PublishContainerImages.WriteLog(metadataJson); }