Skip to content

Add -PrepareOnly switch to New-WtWingetPackage for pre-packaging customization#260

Merged
svrooij merged 3 commits into
mainfrom
copilot/allow-downloading-installer-customization
Jul 3, 2026
Merged

Add -PrepareOnly switch to New-WtWingetPackage for pre-packaging customization#260
svrooij merged 3 commits into
mainfrom
copilot/allow-downloading-installer-customization

Conversation

Copilot AI commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

-PartialPackage creates a .partial.intunewin for direct upload — it does not leave raw source files for customization. Users who need to swap scripts (e.g., custom uninstall logic) before packaging had no supported path to do so.

Adds a new -PrepareOnly switch that downloads the installer and generates all supporting files (install/uninstall/detection scripts, app.json, readme.txt) directly into the output package folder, then stops — no .intunewin is created.

New-WtWingetPackage -PackageId Microsoft.PowerToys -PackageFolder C:\Temp\IntuneApps -PrepareOnly
# Populates C:\Temp\IntuneApps\Microsoft.PowerToys\0.91.1\ with all source files
# No .intunewin created — customize then package manually

Changes

  • PackageOptions — new PrepareOnly bool property
  • WingetPackagePackageFile made nullable (string?); returned as null when no .intunewin is produced
  • IntuneManager — both GenerateMsiPackage and GenerateNoneMsiInstaller route the installer download to the output folder (instead of temp) and skip IIntunePackager.CreatePackage when PrepareOnly = true
  • NewWtWingetPackage — new -PrepareOnly SwitchParameter wired through to PackageOptions
  • Tests — two new IntuneManagerTests covering EXE and MSI PrepareOnly paths; static constructor added to register Kiota JSON serializers for test isolation (previously tests only passed due to implicit registration ordering from GraphStoreAppUploaderTests)

Copilot AI changed the title [WIP] Fix partial package creation to leave source files Add -PrepareOnly switch to New-WtWingetPackage for pre-packaging customization Jul 3, 2026
Copilot AI requested a review from svrooij July 3, 2026 19:51
@svrooij
svrooij requested a review from Copilot July 3, 2026 20:12
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Test Results

14 tests  ±0   13 ✅ ±0   2s ⏱️ ±0s
10 suites ±0    1 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 212d944. ± Comparison against base commit 0b7a139.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a -PrepareOnly option to the WinTuner/WingetIntune packaging flow so users can generate a fully-populated package folder (installer + scripts + metadata) for customization without producing an .intunewin.

Changes:

  • Introduces PackageOptions.PrepareOnly and wires it through New-WtWingetPackage -PrepareOnly.
  • Updates IntuneManager to download installers into the output package folder and skip IIntunePackager.CreatePackage when PrepareOnly is set.
  • Makes WingetPackage.PackageFile nullable and adds tests for both EXE and MSI PrepareOnly paths.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/WingetIntune.Tests/Intune/IntuneManagerTests.cs Adds PrepareOnly test coverage (EXE/MSI) and registers Kiota JSON serializers for isolation.
src/WingetIntune/Models/WingetPackage.cs Makes PackageFile nullable to represent “no .intunewin produced”.
src/WingetIntune/Models/PackageOptions.cs Adds PrepareOnly option to the packaging options model.
src/WingetIntune/Intune/IntuneManager.cs Routes installer downloads to output folder and skips .intunewin creation when PrepareOnly is true.
src/Svrooij.WinTuner.CmdLets/Commands/NewWtWingetPackage.cs Adds -PrepareOnly switch and passes it into PackageOptions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +260 to +263
var logoPath = Path.GetFullPath(Path.Combine(outputPackageFolder, "..", "logo.png"));
var installerPath = Path.Combine(outputPackageFolder, installerFilename);
var installerUrl = "https://github.com/microsoft/PowerToys/releases/download/v0.91.1/PowerToysSetup-0.91.1-x64.exe";
var installerHash = "AABBCC";
Comment on lines +331 to +333
var installer = IntuneTestConstants.azureCliPackageInfo.Installers!.First();
var installerPath = Path.Combine(outputPackageFolder, installer.InstallerFilename!);
var logoPath = Path.GetFullPath(Path.Combine(outputPackageFolder, "..", "logo.png"));
Comment on lines 34 to 38
/// <summary>
/// The filename of the intunewin file
/// </summary>
public string PackageFile { get; set; }
public string? PackageFile { get; set; }

@svrooij
svrooij marked this pull request as ready for review July 3, 2026 21:32
@svrooij
svrooij merged commit 84b622b into main Jul 3, 2026
9 checks passed
@svrooij
svrooij deleted the copilot/allow-downloading-installer-customization branch July 3, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Allow downloading the installer and package customization before packaging

3 participants