Repository navigation
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Repair can accept unseen terms by displaying agreements for a different version or source than it actually uses, while unnecessary remote-agreement checks can block otherwise local repairs.
4 open issues
1 file not reviewed
src/PowerShell/Microsoft.WinGet.Client.Engine/Properties/Resources.Designer.cs: Generated file
What changed in this PR
Adds source and package agreement handling to WinGet’s PowerShell modules, building on the source agreement support introduced in #6612. Interactive users are prompted, while non-interactive use temporarily retains automatic acceptance with deprecation warnings.
Changes:
- Adds agreement switches, consent handling, localized messages, and DSC integration.
- Documents the new behavior and adds Pester coverage and an agreement-specific test package.
- Updates test pipeline inputs and enables warnings-as-errors across all configurations in four PowerShell projects.
| File | Description |
|---|---|
| templates/jobs-powershell-module.yml | Supplies static test files to both PowerShell test jobs. |
| src/PowerShell/tests/RunTests.ps1 | Passes the static-file root into client tests. |
| src/PowerShell/tests/Microsoft.WinGet.DSC.Tests.ps1 | Tests DSC installation of a package with agreements. |
| src/PowerShell/tests/Microsoft.WinGet.Client.Tests.ps1 | Adds package and source agreement scenarios. |
| src/PowerShell/Microsoft.WinGet.DSC/Microsoft.WinGet.DSC.psm1 | Adds the default-enabled AcceptAgreements property. |
| src/PowerShell/Microsoft.WinGet.Configuration.Engine/Microsoft.WinGet.Configuration.Engine.csproj | Enables warnings-as-errors for every configuration. |
| src/PowerShell/Microsoft.WinGet.Configuration.Cmdlets/Microsoft.WinGet.Configuration.Cmdlets.csproj | Enables warnings-as-errors for every configuration. |
| src/PowerShell/Microsoft.WinGet.Client.Engine/Properties/Resources.resx | Adds agreement prompts, warnings, and errors. |
| src/PowerShell/Microsoft.WinGet.Client.Engine/Properties/Resources.Designer.cs | Exposes the new resource strings. |
| src/PowerShell/Microsoft.WinGet.Client.Engine/Microsoft.WinGet.Client.Engine.csproj | Enables warnings-as-errors for every configuration. |
| src/PowerShell/Microsoft.WinGet.Client.Engine/Helpers/AgreementConsent.cs | Centralizes agreement formatting and consent decisions. |
| src/PowerShell/Microsoft.WinGet.Client.Engine/Exceptions/PackageAgreementsUnavailableException.cs | Reports unreadable package agreements. |
| src/PowerShell/Microsoft.WinGet.Client.Engine/Exceptions/PackageAgreementsNotAcceptedException.cs | Reports declined package agreements. |
| src/PowerShell/Microsoft.WinGet.Client.Engine/Exceptions/NoSourcesAvailableException.cs | Reports exclusion of all usable sources. |
| src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/RepairPackageCommand.cs | Adds agreement handling before repair. |
| src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/InstallerPackageCommand.cs | Requests consent before installation and updates. |
| src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/DownloadCommand.cs | Requests consent before downloading packages. |
| src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/Common/PackageCommand.cs | Adds shared package agreement retrieval and consent. |
| src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/Common/InstallCommand.cs | Enables native agreement acceptance after consent. |
| src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/Common/FinderCommand.cs | Handles source consent, persistence, and exclusion. |
| src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Microsoft.WinGet.Client.Cmdlets.csproj | Enables warnings-as-errors for every configuration. |
| src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/UpdatePackageCmdlet.cs | Forwards agreement switches to update operations. |
| src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/UninstallPackageCmdlet.cs | Forwards source agreement acceptance. |
| src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/RepairPackageCmdlet.cs | Exposes and forwards repair agreement options. |
| src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/InstallPackageCmdlet.cs | Forwards agreement switches to installation. |
| src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/InstallerSelectionCmdlet.cs | Exposes the shared package agreement switch. |
| src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetPackageCmdlet.cs | Forwards source agreement acceptance. |
| src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/FindPackageCmdlet.cs | Forwards source agreement acceptance. |
| src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/ExportPackageCmdlet.cs | Forwards agreement switches to downloads. |
| src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/Common/FinderCmdlet.cs | Exposes the source agreement switch. |
| src/PowerShell/Help/Microsoft.WinGet.Client/Update-WinGetPackage.md | Documents update agreement switches. |
| src/PowerShell/Help/Microsoft.WinGet.Client/Uninstall-WinGetPackage.md | Documents source agreement handling during uninstall. |
| src/PowerShell/Help/Microsoft.WinGet.Client/Repair-WinGetPackage.md | Documents repair agreement switches. |
| src/PowerShell/Help/Microsoft.WinGet.Client/Install-WinGetPackage.md | Documents installation agreement switches. |
| src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetPackage.md | Documents source consent for installed-package queries. |
| src/PowerShell/Help/Microsoft.WinGet.Client/Find-WinGetPackage.md | Documents source consent for searches. |
| src/PowerShell/Help/Microsoft.WinGet.Client/Export-WinGetPackage.md | Documents download agreement switches. |
| src/PowerShell/CommonFiles/PowerShellCmdlet.cs | Adds host-aware confirmation on the PowerShell thread. |
| src/AppInstallerCLIE2ETests/TestData/Manifests/TestExeInstaller_PackageAgreements.yaml | Adds an isolated package agreement test fixture. |
| doc/release-notes/1.31/powershell-agreement-consent.md | Describes consent behavior and automation deprecations. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


📖 Description
Add agreement handling to PowerShell cmdlets. This is similar to the changes in #6612 for the MCP server but with a goal to be more backward compatible to maintain functionality for existing PowerShell usage. After sufficient warning time with the deprecation, that will be removed and automation will require the agreement option.
In interactive use, and without the option supplied, the user will be prompted for a response.
🔍 Validation
New and updated Pester tests for module and resources.
Microsoft Reviewers: Open in CodeFlow