/// <summary> /// Invokes the builder in a dedicated working directory. /// </summary> private static async Task BuildAsync(IIntuneAppPackageBuilder builder, IIntuneAppPackagingService packagingService, string output, ILogger logger) { var cd = Environment.CurrentDirectory; Environment.CurrentDirectory = output; try { var package = await builder.BuildAsync(null); package.Data.Position = 0; var baseFileName = Path.GetFileNameWithoutExtension(package.App.FileName); File.WriteAllText($"{baseFileName}.intunewin.json", JsonConvert.SerializeObject(package, Formatting.Indented)); await using (var fs = File.Open($"{baseFileName}.intunewin", FileMode.Create, FileAccess.Write, FileShare.Read)) await package.Data.CopyToAsync(fs); await using (var fs = File.Open($"{baseFileName}.portal.intunewin", FileMode.Create, FileAccess.Write, FileShare.Read)) await packagingService.BuildPackageForPortalAsync(package, fs); logger.LogInformation($"Finished writing {baseFileName} package files to {output}."); } finally { Environment.CurrentDirectory = cd; } }
public PathIntuneAppPackageBuilder(string path, IIntuneAppPackagingService packagingService) { Name = Path.GetFullPath(path); this.path = path; this.packagingService = packagingService; }