Skip to content

Honor DSCv3 package installMode for silent and interactive#6249

Merged
JohnMcPMS merged 6 commits into
microsoft:masterfrom
Trenly:DSCQuiet
May 27, 2026
Merged

Honor DSCv3 package installMode for silent and interactive#6249
JohnMcPMS merged 6 commits into
microsoft:masterfrom
Trenly:DSCQuiet

Conversation

@Trenly
Copy link
Copy Markdown
Contributor

@Trenly Trenly commented May 26, 2026

📖 Description

When using DSCv3 Microsoft.WinGet/Package resource with installMode: silent specified, WinGet was not honoring the requested mode and instead defaulting to SilentWithProgress. This resulted in progress UI being shown and manifest custom switches being omitted from installer arguments.

This PR maps the installMode property (declared in DscPackageResource) to execution context args (--silent or --interactive) before install/update/reinstall workflows execute, ensuring:

  • installMode: silent selects Silent installer switches
  • installMode: interactive selects Interactive installer switches
  • installMode: default preserves existing behavior (no mode arg added)
  • Manifest custom switches continue to be appended to installer arguments

🔗 References

Resolves #6248

🔍 Validation

Added DSCv3 E2E regression tests in DSCv3PackageResourceCommand.cs:

  • Package_Set_SilentInstallMode_UsesSilentAndCustomSwitches: Validates silent mode uses /exesilent and includes /execustom
  • Package_Set_InteractiveInstallMode_UsesInteractiveAndCustomSwitches: Validates interactive mode uses /exeinteractive and includes /execustom

Environment note: Targeted test execution was attempted but blocked by missing Visual C++ MSBuild targets (MSB4278). Tests require Visual Studio build environment.

✅ Checklist

📋 Issue Type

  • Bug fix
  • Feature
  • Task

Copilot assisted with this PR.

@Trenly Trenly marked this pull request as ready for review May 26, 2026 16:08
@Trenly Trenly requested a review from a team as a code owner May 26, 2026 16:08
Copy link
Copy Markdown
Member

@JohnMcPMS JohnMcPMS left a comment

Choose a reason for hiding this comment

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

I somehow just completely dropped using this value in the original change. I think it was a late addition and I must have gotten distracted after adding it to the surface to not consume it.

I don't know why the custom arg would not be present, but I don't think that this change would actually affect it. I'm investigating that portion locally.

[Test]
public void Package_Set_SilentInstallMode_UsesSilentAndCustomSwitches()
{
string installDir = Path.GetTempPath();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems like optimistic 🤖 here; the installDir is not a DSC property nor does it even attempt to pass it along. I think you would have to rely on the default install location or invent a new mechanism to pass it along in a side channel (like environment variable or known registry value). If you could update RunDSCv3Command to set an environment variable on the new process, that would be the safest way to not impact other tests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I just tried:

PS> @{id="Microsoft.Azd"; source="winget"; useLatest=$true; installMode="silent"} | ConvertTo-Json | wingetdev dscv3 package --set

and see:

2026-05-26 11:27:29.274 <I> [CLI ] Installer args: /passive /norestart /log "%LOCALAPPDATA%\Packages\WinGetDevCLI_8wekyb3d8bbwe\LocalState\DiagOutputDir\Microsoft.Azd.1.25.300-26-05-26-11-27-29.log" INSTALLEDBY="winget"

Where https://github.com/microsoft/winget-pkgs/blob/9e3e07ee8ee60e7689f5f930a5f3852fe68fb03c/manifests/m/Microsoft/Azd/1.25.300/Microsoft.Azd.installer.yaml#L9 has the INSTALLEDBY="winget".

@JohnMcPMS
Copy link
Copy Markdown
Member

@Trenly , do you think you have a timeframe? Not trying to rush you but we are looking to branch the 1.29 RC soon and wanted to include this. If you can't get to it today, I can update the tests.

@Trenly
Copy link
Copy Markdown
Contributor Author

Trenly commented May 26, 2026

@Trenly , do you think you have a timeframe? Not trying to rush you but we are looking to branch the 1.29 RC soon and wanted to include this. If you can't get to it today, I can update the tests.

If you want to update the tests, might be faster; I should be free in ~1hr but not sure the 🤖 knows exactly what it's doing

Edit: Throwing the 🤖 at it now
Edit Edit: It has no clue what it's doing - still fastest if you implment

@JohnMcPMS
Copy link
Copy Markdown
Member

If you want to update the tests, might be faster; I should be free in ~1hr but not sure the 🤖 knows exactly what it's doing

Edit: Throwing the 🤖 at it now Edit Edit: It has no clue what it's doing - still fastest if you implment

I pushed what I'm thinking, but the machine I'm on isn't building anything happily at the moment. Will let pipeline tell me if anything is wrong but you can also run with it if you get a chance before I do to circle back.

@JohnMcPMS
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

* ##[warning]src\AppInstallerTestExeInstaller\main.cpp(622,27): Warning C4996: 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
@github-actions

This comment has been minimized.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JohnMcPMS
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@JohnMcPMS
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@JohnMcPMS JohnMcPMS merged commit 22442d6 into microsoft:master May 27, 2026
9 checks passed
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.

DSCv3: installMode 'silent' uses SilentWithProgress switches instead of Silent

3 participants