示例#1
0
        /// <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;
            }
        }
示例#2
0
 public PathIntuneAppPackageBuilder(string path, IIntuneAppPackagingService packagingService)
 {
     Name                  = Path.GetFullPath(path);
     this.path             = path;
     this.packagingService = packagingService;
 }