winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 8dda5b6461fafe1c459f02c735bfd64cffb9795f
parent 65ed18d4f2117902da49d31d7971a9d077921d36
Author: KEINOS <github+fork-qiita-news@keinos.com>
Date:   Wed, 11 Jun 2025 18:38:50 +0000

Merge remote-tracking branch 'upstream/master'

Diffstat:
M.github/PULL_REQUEST_TEMPLATE.md | 1+
Adoc/ReleaseNotes.md | 20++++++++++++++++++++
Mdoc/Settings.md | 10++++++++++
Msrc/AppInstallerCLI.sln | 1+
Msrc/PowerShell/Microsoft.WinGet.Client.Engine/Helpers/AppxModuleHelper.cs | 170+++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
5 files changed, 146 insertions(+), 56 deletions(-)

diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,7 @@ <!-- To check a checkbox place an "x" between the brackets. e.g: [x] --> - [ ] I have signed the [Contributor License Agreement](https://cla.opensource.microsoft.com/microsoft/winget-pkgs). +- [ ] I have updated the [Release Notes](../doc/ReleaseNotes.md). - [ ] This pull request is related to an issue. ----- diff --git a/doc/ReleaseNotes.md b/doc/ReleaseNotes.md @@ -0,0 +1,20 @@ +## New in v1.11 +* Dropped support for running on 32-bit ARM +* Support for [Microsoft Desired State Configuration (DSC) v3](https://learn.microsoft.com/powershell/dsc/overview?view=dsc-3.0). +* Support for exporting the configuration of the current device. This includes Windows Settings, packages from configured WinGet sources, and package settings from DSC v3 enabled packages. + +## Experimental Features +* Experimental support for Fonts + +--- +### Experimental support for Fonts +The following snippet enables experimental support for fonts via `winget settings`. The `winget font list` command will list installed font families and the number of installed font faces. +```JSON +{ + "$schema" "https://aka.ms/winget-settings.schema.json", + "experimentalFeatures": { + "fonts": true + } +} + +``` diff --git a/doc/Settings.md b/doc/Settings.md @@ -354,3 +354,13 @@ You can enable the feature as shown below. "resume": true }, ``` + +### fonts + +This feature enables support for fonts via `winget settings`. The `winget font list` command will list installed font families and the number of installed font faces. + +```json + "experimentalFeatures": { + "fonts": true + }, +``` diff --git a/src/AppInstallerCLI.sln b/src/AppInstallerCLI.sln @@ -37,6 +37,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Project", "Project", "{8D53 ..\cgmanifest.json = ..\cgmanifest.json ..\README.md = ..\README.md ..\doc\Settings.md = ..\doc\Settings.md + ..\doc\ReleaseNotes.md = ..\doc\ReleaseNotes.md ..\WinGetInProcCom.nuspec = ..\WinGetInProcCom.nuspec ..\WinGetUtil.nuspec = ..\WinGetUtil.nuspec EndProjectSection diff --git a/src/PowerShell/Microsoft.WinGet.Client.Engine/Helpers/AppxModuleHelper.cs b/src/PowerShell/Microsoft.WinGet.Client.Engine/Helpers/AppxModuleHelper.cs @@ -45,6 +45,7 @@ namespace Microsoft.WinGet.Client.Engine.Helpers private const string LicensePath = "LicensePath"; private const string Module = "Module"; private const string StubPackageOption = "StubPackageOption"; + private const string PackageTypeFilter = "PackageTypeFilter"; // Parameter Values private const string Appx = "Appx"; @@ -52,6 +53,7 @@ namespace Microsoft.WinGet.Client.Engine.Helpers private const string SilentlyContinue = "SilentlyContinue"; private const string Online = "Online"; private const string UsePreference = "UsePreference"; + private const string Framework = "Framework"; // Options private const string UseWindowsPowerShell = "UseWindowsPowerShell"; @@ -65,6 +67,8 @@ namespace Microsoft.WinGet.Client.Engine.Helpers private const string PackageFullName = "PackageFullName"; private const string Version = "Version"; + private const string DependencyArchitectureEnvironmentVariable = "WINGET_PACKAGE_MANAGER_REPAIR_DEPENDENCY_ARCHITECTURES"; + // Assets private const string MsixBundleName = "Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"; private const string DependenciesJsonName = "DesktopAppInstaller_Dependencies.json"; @@ -92,6 +96,7 @@ namespace Microsoft.WinGet.Client.Engine.Helpers private readonly PowerShellCmdlet pwshCmdlet; private readonly HttpClientHelper httpClientHelper; + private Lazy<HashSet<Architecture>> frameworkArchitectures; /// <summary> /// Initializes a new instance of the <see cref="AppxModuleHelper"/> class. @@ -101,6 +106,7 @@ namespace Microsoft.WinGet.Client.Engine.Helpers { this.pwshCmdlet = pwshCmdlet; this.httpClientHelper = new HttpClientHelper(); + this.frameworkArchitectures = new Lazy<HashSet<Architecture>>(() => this.InitFrameworkArchitectures()); } /// <summary> @@ -343,33 +349,87 @@ namespace Microsoft.WinGet.Client.Engine.Helpers } } - private Dictionary<string, string> GetDependenciesByArch(PackageDependency dependencies) + /// <summary> + /// Extracts all of the architectures used by framework packages. + /// </summary> + /// <returns>The set of architectures used by installed framework packages.</returns> + private HashSet<Architecture> InitFrameworkArchitectures() { - Dictionary<string, string> appxPackages = new Dictionary<string, string>(); - var arch = RuntimeInformation.OSArchitecture; + HashSet<Architecture> architectures = new HashSet<Architecture>(); - string appxPackageX64 = string.Format(ExtractedDependencyPath, "x64", dependencies.Name, dependencies.Version); - string appxPackageX86 = string.Format(ExtractedDependencyPath, "x86", dependencies.Name, dependencies.Version); - string appxPackageArm64 = string.Format(ExtractedDependencyPath, "arm64", dependencies.Name, dependencies.Version); - - if (arch == Architecture.X64) - { - appxPackages.Add("x64", appxPackageX64); - } - else if (arch == Architecture.X86) + string? environmentVariable = Environment.GetEnvironmentVariable(DependencyArchitectureEnvironmentVariable); + if (environmentVariable != null) { - appxPackages.Add("x86", appxPackageX86); + this.pwshCmdlet.Write(StreamType.Verbose, $"Using environment variable {DependencyArchitectureEnvironmentVariable} for frameworks: {environmentVariable}"); + + foreach (string architectureString in environmentVariable.Split(',', ';')) + { + Architecture architecture; + if (Enum.TryParse(architectureString, true, out architecture)) + { + if (architectures.Add(architecture)) + { + this.pwshCmdlet.Write(StreamType.Verbose, $"Framework architecture from environment variable: {architectureString}"); + } + } + } + + return architectures; } - else if (arch == Architecture.Arm64) + + var result = this.ExecuteAppxCmdlet( + GetAppxPackage, + new Dictionary<string, object> + { + { PackageTypeFilter, Framework }, + }); + + if (result != null && + result.Count > 0) { - // Deployment please figure out for me. - appxPackages.Add("x64", appxPackageX64); - appxPackages.Add("x86", appxPackageX86); - appxPackages.Add("arm64", appxPackageArm64); + foreach (dynamic psobject in result) + { + string? architectureString = psobject?.Architecture?.ToString(); + if (architectureString == null) + { + continue; + } + + Architecture architecture; + if (Enum.TryParse(architectureString, true, out architecture)) + { + if (architectures.Add(architecture)) + { + this.pwshCmdlet.Write(StreamType.Verbose, $"Found framework architecture: {architectureString}"); + } + } + } } - else + + return architectures; + } + + private Dictionary<string, string> GetDependenciesByArch(PackageDependency dependencies) + { + Dictionary<string, string> appxPackages = new Dictionary<string, string>(); + + foreach (var architecture in this.frameworkArchitectures.Value) { - throw new PSNotSupportedException(arch.ToString()); + switch (architecture) + { + case Architecture.X86: + appxPackages.Add("x86", string.Format(ExtractedDependencyPath, "x86", dependencies.Name, dependencies.Version)); + break; + case Architecture.X64: + appxPackages.Add("x64", string.Format(ExtractedDependencyPath, "x64", dependencies.Name, dependencies.Version)); + break; + case Architecture.Arm64: + appxPackages.Add("arm64", string.Format(ExtractedDependencyPath, "arm64", dependencies.Name, dependencies.Version)); + break; + default: + this.pwshCmdlet.Write(StreamType.Verbose, $"GetDependenciesByArch: Ignoring {architecture}"); + break; + } } return appxPackages; @@ -522,25 +582,24 @@ namespace Microsoft.WinGet.Client.Engine.Helpers private Dictionary<string, string> GetVCLibsDependencies() { Dictionary<string, string> vcLibsDependencies = new Dictionary<string, string>(); - var arch = RuntimeInformation.OSArchitecture; - if (arch == Architecture.X64) - { - vcLibsDependencies.Add("x64", VCLibsUWPDesktopX64); - } - else if (arch == Architecture.X86) - { - vcLibsDependencies.Add("x86", VCLibsUWPDesktopX86); - } - else if (arch == Architecture.Arm64) - { - // Deployment please figure out for me. - vcLibsDependencies.Add("x64", VCLibsUWPDesktopX64); - vcLibsDependencies.Add("x86", VCLibsUWPDesktopX86); - vcLibsDependencies.Add("arm64", VCLibsUWPDesktopArm64); - } - else + + foreach (var architecture in this.frameworkArchitectures.Value) { - throw new PSNotSupportedException(arch.ToString()); + switch (architecture) + { + case Architecture.X86: + vcLibsDependencies.Add("x86", VCLibsUWPDesktopX86); + break; + case Architecture.X64: + vcLibsDependencies.Add("x64", VCLibsUWPDesktopX64); + break; + case Architecture.Arm64: + vcLibsDependencies.Add("arm64", VCLibsUWPDesktopArm64); + break; + default: + this.pwshCmdlet.Write(StreamType.Verbose, $"GetVCLibsDependencies: Ignoring {architecture}"); + break; + } } return vcLibsDependencies; @@ -561,25 +620,24 @@ namespace Microsoft.WinGet.Client.Engine.Helpers var xamlRelease = await githubRelease.GetReleaseAsync(xamlReleaseTag); var packagesToInstall = new List<ReleaseAsset>(); - var arch = RuntimeInformation.OSArchitecture; - if (arch == Architecture.X64) - { - packagesToInstall.Add(xamlRelease.GetAsset(xamlAssetX64)); - } - else if (arch == Architecture.X86) - { - packagesToInstall.Add(xamlRelease.GetAsset(xamlAssetX86)); - } - else if (arch == Architecture.Arm64) - { - // Deployment please figure out for me. - packagesToInstall.Add(xamlRelease.GetAsset(xamlAssetX64)); - packagesToInstall.Add(xamlRelease.GetAsset(xamlAssetX86)); - packagesToInstall.Add(xamlRelease.GetAsset(xamlAssetArm64)); - } - else + + foreach (var architecture in this.frameworkArchitectures.Value) { - throw new PSNotSupportedException(arch.ToString()); + switch (architecture) + { + case Architecture.X86: + packagesToInstall.Add(xamlRelease.GetAsset(xamlAssetX86)); + break; + case Architecture.X64: + packagesToInstall.Add(xamlRelease.GetAsset(xamlAssetX64)); + break; + case Architecture.Arm64: + packagesToInstall.Add(xamlRelease.GetAsset(xamlAssetArm64)); + break; + default: + this.pwshCmdlet.Write(StreamType.Verbose, $"InstallUiXamlAsync: Ignoring {architecture}"); + break; + } } foreach (var package in packagesToInstall)