From 092260ca094bdfcb37178c2e7c8073ccee5708b5 Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Thu, 7 Jul 2022 03:38:16 -0700 Subject: [PATCH 01/21] Initial commit of Microsoft.WinGet.Client project files. --- src/AppInstallerCLI.sln | 47 +- .../Attributes/FilterAttribute.cs | 23 + .../Microsoft.WinGet.Client/BuildModule.ps1 | 38 + .../Commands/BaseClientCommand.cs | 69 ++ .../Commands/BaseFinderCommand.cs | 207 +++++ .../Commands/BaseFinderExtendedCommand.cs | 57 ++ .../Commands/BaseInstallCommand.cs | 157 ++++ .../Commands/BaseLifecycleCommand.cs | 133 +++ .../Commands/FindPackageCommand.cs | 33 + .../Commands/GetPackageCommand.cs | 33 + .../Commands/GetSourceCommand.cs | 43 + .../Commands/InstallPackageCommand.cs | 98 +++ .../Commands/UninstallPackageCommand.cs | 102 +++ .../Commands/UpdatePackageCommand.cs | 63 ++ .../Microsoft.WinGet.Client/Crescendo.json | 127 +++ .../Errors/FindPackagesException.cs | 33 + .../Errors/VagueCriteriaException.cs | 40 + .../Factories/ComObjectFactory.cs | 101 +++ .../Microsoft.WinGet.Client/Format.ps1xml | 135 ++++ .../Helpers/CatalogPackageExtensions.cs | 38 + .../Helpers/Constants.cs | 46 ++ .../Helpers/WriteProgressAdapter.cs | 92 +++ .../Microsoft.WinGet.Client.csproj | 38 + .../Microsoft.WinGet.Client.psd1 | 171 ++++ .../Microsoft.WinGet.Client.psm1 | 755 ++++++++++++++++++ .../PlatyPS/en-US/Add-WinGetSource.md | 90 +++ .../en-US/Disable-WinGetLocalManifest.md | 45 ++ .../en-US/Enable-WinGetLocalManifest.md | 45 ++ .../PlatyPS/en-US/Find-WinGetPackage.md | 188 +++++ .../PlatyPS/en-US/Get-WinGetPackage.md | 188 +++++ .../PlatyPS/en-US/Get-WinGetSource.md | 61 ++ .../PlatyPS/en-US/Get-WinGetVersion.md | 45 ++ .../PlatyPS/en-US/Install-WinGetPackage.md | 344 ++++++++ .../PlatyPS/en-US/Remove-WinGetSource.md | 60 ++ .../PlatyPS/en-US/Reset-WinGetSource.md | 60 ++ .../PlatyPS/en-US/Uninstall-WinGetPackage.md | 245 ++++++ .../PlatyPS/en-US/Update-WinGetPackage.md | 322 ++++++++ .../Microsoft.WinGet.Client/README.md | 25 + .../Microsoft.WinGet.Client/stylecop.json | 10 + 39 files changed, 4406 insertions(+), 1 deletion(-) create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Attributes/FilterAttribute.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/BuildModule.ps1 create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Commands/BaseClientCommand.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderExtendedCommand.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Commands/BaseInstallCommand.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Commands/BaseLifecycleCommand.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Commands/FindPackageCommand.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Commands/GetPackageCommand.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Commands/GetSourceCommand.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Crescendo.json create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Errors/FindPackagesException.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Errors/VagueCriteriaException.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Factories/ComObjectFactory.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Format.ps1xml create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Helpers/CatalogPackageExtensions.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Helpers/Constants.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Helpers/WriteProgressAdapter.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psm1 create mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Add-WinGetSource.md create mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Disable-WinGetLocalManifest.md create mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Enable-WinGetLocalManifest.md create mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Find-WinGetPackage.md create mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetPackage.md create mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetSource.md create mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetVersion.md create mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Install-WinGetPackage.md create mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Remove-WinGetSource.md create mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Reset-WinGetSource.md create mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Uninstall-WinGetPackage.md create mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Update-WinGetPackage.md create mode 100644 src/PowerShell/Microsoft.WinGet.Client/README.md create mode 100644 src/PowerShell/Microsoft.WinGet.Client/stylecop.json diff --git a/src/AppInstallerCLI.sln b/src/AppInstallerCLI.sln index 96b602712a..8f084fcebd 100644 --- a/src/AppInstallerCLI.sln +++ b/src/AppInstallerCLI.sln @@ -1,4 +1,4 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29409.12 MinimumVisualStudioVersion = 10.0.40219.1 @@ -136,6 +136,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "COMServer", "COMServer\COMS EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Management.Deployment.InProc", "Microsoft.Management.Deployment.InProc\Microsoft.Management.Deployment.InProc.vcxproj", "{9AC3C6A4-1875-4D3E-BF9C-C31E81EFF6B4}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PowerShell", "PowerShell", "{7C218A3E-9BC8-48FF-B91B-BCACD828C0C9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.WinGet.Client", "PowerShell\Microsoft.WinGet.Client\Microsoft.WinGet.Client.csproj", "{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution ManifestSchema\ManifestSchema.vcxitems*{1622da16-914f-4f57-a259-d5169003cc8c}*SharedItemsImports = 4 @@ -1026,6 +1030,46 @@ Global {9AC3C6A4-1875-4D3E-BF9C-C31E81EFF6B4}.TestRelease|x64.Build.0 = Release|x64 {9AC3C6A4-1875-4D3E-BF9C-C31E81EFF6B4}.TestRelease|x86.ActiveCfg = Release|Win32 {9AC3C6A4-1875-4D3E-BF9C-C31E81EFF6B4}.TestRelease|x86.Build.0 = Release|Win32 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|Any CPU.ActiveCfg = Debug|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|Any CPU.Build.0 = Debug|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|ARM.ActiveCfg = Debug|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|ARM.Build.0 = Debug|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|ARM64.Build.0 = Debug|ARM64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|x64.ActiveCfg = Debug|x64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|x64.Build.0 = Debug|x64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|x86.ActiveCfg = Debug|x86 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|x86.Build.0 = Debug|x86 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|Any CPU.ActiveCfg = Debug|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|Any CPU.Build.0 = Debug|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|ARM.ActiveCfg = Debug|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|ARM.Build.0 = Debug|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|ARM64.ActiveCfg = Debug|ARM64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|ARM64.Build.0 = Debug|ARM64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x64.ActiveCfg = Debug|x64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x64.Build.0 = Debug|x64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x86.ActiveCfg = Debug|x86 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x86.Build.0 = Debug|x86 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|Any CPU.ActiveCfg = Release|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|Any CPU.Build.0 = Release|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|ARM.ActiveCfg = Release|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|ARM.Build.0 = Release|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|ARM64.ActiveCfg = Release|ARM64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|ARM64.Build.0 = Release|ARM64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|x64.ActiveCfg = Release|x64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|x64.Build.0 = Release|x64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|x86.ActiveCfg = Release|x86 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|x86.Build.0 = Release|x86 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|Any CPU.ActiveCfg = Debug|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|Any CPU.Build.0 = Debug|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM.ActiveCfg = Debug|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM.Build.0 = Debug|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM64.ActiveCfg = Debug|ARM64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM64.Build.0 = Debug|ARM64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x64.ActiveCfg = Debug|x64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x64.Build.0 = Debug|x64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x86.ActiveCfg = Debug|x86 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x86.Build.0 = Debug|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1045,6 +1089,7 @@ Global {866C3F06-636F-4BE8-BC24-5F86ECC606A1} = {60618CAC-2995-4DF9-9914-45C6FC02C995} {1A47951F-5C7A-4D6D-BB5F-D77484437940} = {8D53D749-D51C-46F8-A162-9371AAA6C2E7} {409CD681-22A4-469D-88AE-CB5E4836E07A} = {8D53D749-D51C-46F8-A162-9371AAA6C2E7} + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C} = {7C218A3E-9BC8-48FF-B91B-BCACD828C0C9} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B6FDB70C-A751-422C-ACD1-E35419495857} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Attributes/FilterAttribute.cs b/src/PowerShell/Microsoft.WinGet.Client/Attributes/FilterAttribute.cs new file mode 100644 index 0000000000..5b283705a4 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Attributes/FilterAttribute.cs @@ -0,0 +1,23 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Attributes +{ + using System; + using Microsoft.Management.Deployment; + + /// + /// Marking a property with this attribute causes it to be added to the filters list when searching for packages. + /// + [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] + public class FilterAttribute : Attribute + { + /// + /// Gets or sets the field that the filter will be matching against. + /// + public PackageMatchField Field { get; set; } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/BuildModule.ps1 b/src/PowerShell/Microsoft.WinGet.Client/BuildModule.ps1 new file mode 100644 index 0000000000..e2630125e9 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/BuildModule.ps1 @@ -0,0 +1,38 @@ +# Copyright (c) Microsoft Corporation. Licensed under the MIT License. + +[CmdletBinding()] +param ( + [Parameter()] + $In = "$PSScriptRoot\bin", + + [Parameter()] + [string] + $Out = "$PSScriptRoot\build\bin", + + [Parameter()] + [string] + $Configuration = 'Release' +) + +$CoreFramework = 'net6.0-windows10.0.22000.0' +$DesktopFramework = 'net461' + +if (Test-Path $Out) { + Remove-Item $Out -Recurse +} + +Get-ChildItem $In -ErrorAction SilentlyContinue -Exclude 'Debug','Release' | ForEach-Object { + Write-Verbose ($_.FullName) + + $coreSrcPath = Join-Path $_.FullName $Configuration $CoreFramework + $coreDstPath = Join-Path $Out $_.Name 'Core' + $desktopSrcPath = Join-Path $_.FullName $Configuration $DesktopFramework + $desktopDstPath = Join-Path $Out $_.Name 'Desktop' + + Copy-Item $coreSrcPath -Destination $coreDstPath -Recurse -Force + Copy-Item $desktopSrcPath -Destination $desktopDstPath -Recurse -Force +} + +Copy-Item 'Format.ps1xml' -Destination $Out +Copy-Item 'Microsoft.WinGet.Client.psd1' -Destination $Out +Copy-Item 'Microsoft.WinGet.Client.psm1' -Destination $Out diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseClientCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseClientCommand.cs new file mode 100644 index 0000000000..eada00fcf9 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseClientCommand.cs @@ -0,0 +1,69 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System; + using System.Collections.Generic; + using System.Management.Automation; + using System.Security.Principal; + using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Factories; + + /// + /// This is the base class for all commands in this module. + /// + public class BaseClientCommand : PSCmdlet + { + /// + /// Initializes a new instance of the class. + /// + public BaseClientCommand() + : base() + { + var identity = WindowsIdentity.GetCurrent(); + var principal = new WindowsPrincipal(identity); + var admin = principal.IsInRole(WindowsBuiltInRole.Administrator); + if (admin) + { + throw new Exception(@"This cmdlet is currently not available in an administrator context."); + } + } + + /// + /// Gets the instance of the class. + /// + protected static Lazy ComObjectFactory { get; } = new Lazy(); + + /// + /// Gets the instance of the class. + /// + protected static Lazy PackageManager { get; } = new Lazy(() => ComObjectFactory.Value.CreatePackageManager()); + + /// + /// Retrieves the specified source or all sources if is null. + /// + /// A list of instances. + /// The name of the source to retrieve. If null, then all sources are returned. + /// The source does not exist. + protected static IReadOnlyList GetPackageCatalogReferences(string source) + { + if (source is null) + { + return PackageManager.Value.GetPackageCatalogs(); + } + else + { + return new List() + { + PackageManager.Value.GetPackageCatalogByName(source) + ?? throw new ArgumentException("No sources match the given value: " + source), + }; + } + } + + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs new file mode 100644 index 0000000000..6e7feede24 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs @@ -0,0 +1,207 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Reflection; + using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Attributes; + using Microsoft.WinGet.Client.Errors; + using Microsoft.WinGet.Client.Helpers; + + /// + /// This is the base class for all commands that might need to search for packages. + /// + public class BaseFinderCommand : BaseClientCommand + { + /// + /// Gets or sets the field that is matched against the identifier of a package. + /// + [Filter(Field = PackageMatchField.Id)] + [Parameter( + ParameterSetName = Constants.FoundSet, + ValueFromPipelineByPropertyName = true)] + public string Id { get; set; } + + /// + /// Gets or sets the field that is matched against the name of a package. + /// + [Filter(Field = PackageMatchField.Name)] + [Parameter( + ParameterSetName = Constants.FoundSet, + ValueFromPipelineByPropertyName = true)] + public string Name { get; set; } + + /// + /// Gets or sets the field that is matched against the name of a package. + /// + [Filter(Field = PackageMatchField.Moniker)] + [Parameter( + ParameterSetName = Constants.FoundSet, + ValueFromPipelineByPropertyName = true)] + public string Moniker { get; set; } + + /// + /// Gets or sets the name of the source to search for packages. If null, then all sources are searched. + /// + [Parameter( + ParameterSetName = Constants.FoundSet, + ValueFromPipelineByPropertyName = true)] + public string Source { get; set; } + + /// + /// Gets or sets the strings that match against every field of a package. + /// + [Parameter( + ParameterSetName = Constants.FoundSet, + Position = 0, + ValueFromPipelineByPropertyName = true, + ValueFromRemainingArguments = true)] + public string[] Query { get; set; } + + /// + /// Gets or sets a value indicataing whether to match exactly against package fields. + /// + [Parameter( + ParameterSetName = Constants.FoundSet, + ValueFromPipelineByPropertyName = true)] + public SwitchParameter Exact { get; set; } + + private string QueryAsJoinedString + { + get + { + return (this.Query is null) + ? null + : string.Join(" ", this.Query); + } + } + + private PackageFieldMatchOption ExactAsMatchOption + { + get + { + return this.Exact.ToBool() + ? PackageFieldMatchOption.EqualsCaseInsensitive + : PackageFieldMatchOption.ContainsCaseInsensitive; + } + } + + /// + /// Searches for packages based on the configured parameters. + /// + /// The value. + /// The limit on the number of matches returned. + /// A list of objects. + protected IReadOnlyList FindPackages( + CompositeSearchBehavior behavior, + uint limit) + { + var catalog = this.GetPackageCatalog(behavior); + var options = this.GetFindPackagesOptions(limit); + return GetMatchResults(catalog, options); + } + + private static void SetQueryInFindPackagesOptions( + ref FindPackagesOptions options, + PackageFieldMatchOption match, + string value) + { + var selector = ComObjectFactory.Value.CreatePackageMatchFilter(); + selector.Field = PackageMatchField.CatalogDefault; + selector.Value = value ?? string.Empty; + selector.Option = match; + options.Selectors.Add(selector); + } + + private static void AddFilterToFindPackagesOptionsIfNotNull( + ref FindPackagesOptions options, + PackageMatchField field, + PackageFieldMatchOption match, + string value) + { + if (value != null) + { + var filter = ComObjectFactory.Value.CreatePackageMatchFilter(); + filter.Field = field; + filter.Value = value; + filter.Option = match; + options.Filters.Add(filter); + } + } + + private static IReadOnlyList GetMatchResults( + PackageCatalog catalog, + FindPackagesOptions options) + { + var result = catalog.FindPackages(options); + if (result.Status != FindPackagesResultStatus.Ok) + { + throw new FindPackagesException(result.Status); + } + + return result.Matches; + } + + private PackageCatalog GetPackageCatalog(CompositeSearchBehavior behavior) + { + var reference = this.GetPackageCatalogReference(behavior); + var result = reference.Connect(); + if (result.Status != ConnectResultStatus.Ok) + { + throw new RuntimeException("There was an error connecting to the source."); + } + + return result.PackageCatalog; + } + + private PackageCatalogReference GetPackageCatalogReference(CompositeSearchBehavior behavior) + { + var options = ComObjectFactory.Value.CreateCreateCompositePackageCatalogOptions(); + var references = GetPackageCatalogReferences(this.Source); + for (var i = 0; i < references.Count; i++) + { + options.Catalogs.Add(references[i]); + } + + options.CompositeSearchBehavior = behavior; + return PackageManager.Value.CreateCompositePackageCatalog(options); + } + + private FindPackagesOptions GetFindPackagesOptions(uint limit) + { + var options = ComObjectFactory.Value.CreateFindPackagesOptions(); + SetQueryInFindPackagesOptions(ref options, this.ExactAsMatchOption, this.QueryAsJoinedString); + this.AddAttributedFiltersToFindPackagesOptions(ref options, this.ExactAsMatchOption); + options.ResultLimit = limit; + return options; + } + + private void AddAttributedFiltersToFindPackagesOptions( + ref FindPackagesOptions options, + PackageFieldMatchOption match) + { + var properties = this + .GetType() + .GetProperties() + .Where(property => Attribute.IsDefined(property, typeof(FilterAttribute))); + + foreach (var info in properties) + { + if (info.GetCustomAttribute(typeof(FilterAttribute), true) is FilterAttribute attribute) + { + PackageMatchField field = attribute.Field; + string value = info.GetValue(this, null) as string; + AddFilterToFindPackagesOptionsIfNotNull(ref options, field, match, value); + } + } + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderExtendedCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderExtendedCommand.cs new file mode 100644 index 0000000000..f8b74f0934 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderExtendedCommand.cs @@ -0,0 +1,57 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System.Collections.Generic; + using System.Management.Automation; + using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Attributes; + using Microsoft.WinGet.Client.Helpers; + + /// + /// This is the base class for some of the commands that search for packages. + /// + public class BaseFinderExtendedCommand : BaseFinderCommand + { + /// + /// Gets or sets the filter that is matched against the tags of the package. + /// + [Filter(Field = PackageMatchField.Tag)] + [Parameter( + ParameterSetName = Constants.FoundSet, + ValueFromPipelineByPropertyName = true)] + public string Tag { get; set; } + + /// + /// Gets or sets the filter that is matched against the commands of the package. + /// + [Filter(Field = PackageMatchField.Command)] + [Parameter( + ParameterSetName = Constants.FoundSet, + ValueFromPipelineByPropertyName = true)] + public string Command { get; set; } + + /// + /// Gets or sets the maximum number of results returned. + /// + [ValidateRange(Constants.CountLowerBound, Constants.CountUpperBound)] + [Parameter( + ParameterSetName = Constants.FoundSet, + ValueFromPipelineByPropertyName = true)] + public uint Count { get; set; } + + /// + /// Searches for packages from configured sources. + /// + /// A value. + /// A list of objects. + protected IReadOnlyList FindPackages(CompositeSearchBehavior behavior) + { + return this.FindPackages(behavior, this.Count); + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseInstallCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseInstallCommand.cs new file mode 100644 index 0000000000..973a7784c6 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseInstallCommand.cs @@ -0,0 +1,157 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +#pragma warning disable SA1200 // Using directives should be placed correctly +using Windows.Foundation; +#pragma warning restore SA1200 // Using directives should be placed correctly + +namespace Microsoft.WinGet.Client.Commands +{ + using System.IO; + using System.Management.Automation; + using Microsoft.Management.Deployment; + + /// + /// This is the base class for the install and upgrade commands. + /// + public class BaseInstallCommand : BaseLifecycleCommand + { + private string location; + + /// + /// Gets or sets the mode to manipulate the package with. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public PackageInstallMode Mode { get; set; } = PackageInstallMode.Default; + + /// + /// Gets or sets the override arguments to be passed on to the installer. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public string Override { get; set; } + + /// + /// Gets or sets the installation location. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public string Location + { + get => this.location; + set + { + string prefix = Path.IsPathRooted(value) + ? string.Empty + : this.SessionState.Path.CurrentFileSystemLocation + @"\"; + + this.location = prefix + value; + } + } + + /// + /// Gets or sets a value indicating whether to skip the installer hash validation check. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public SwitchParameter Force { get; set; } + + /// + /// Gets or sets the optional HTTP Header to pass on to the REST Source. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public string Header { get; set; } + + /// + /// Gets the install options from the configured parameters. + /// + /// The to install. + /// An instance. + protected virtual InstallOptions GetInstallOptions(PackageVersionId version) + { + var options = ComObjectFactory.Value.CreateInstallOptions(); + + options.AllowHashMismatch = this.Force.ToBool(); + options.PackageInstallMode = this.Mode; + + if (version != null) + { + options.PackageVersionId = version; + } + + if (this.Log != null) + { + options.LogOutputPath = this.Log; + } + + if (this.Override != null) + { + options.ReplacementInstallerArguments = this.Override; + } + + if (this.Location != null) + { + options.PreferredInstallLocation = this.Location; + } + + if (this.Header != null) + { + options.AdditionalPackageCatalogArguments = this.Header; + } + + return options; + } + + /// + /// Registers callbacks on an asynchronous operation and waits for the results. + /// + /// The asynchronous operation. + /// A instance. + /// A instance. + protected InstallResult RegisterCallbacksAndWait( + IAsyncOperationWithProgress operation, + string activity) + { + var adapter = new Helpers.WriteProgressAdapter(this); + + operation.Progress = (context, progress) => + { + var record = new ProgressRecord(1, activity, progress.State.ToString()) + { + RecordType = ProgressRecordType.Processing, + }; + + if (progress.State == PackageInstallProgressState.Downloading) + { + record.StatusDescription = $"{progress.BytesDownloaded / 1000000.0f:0.0} MB / {progress.BytesRequired / 1000000.0f:0.0} MB"; + record.PercentComplete = (int)(progress.DownloadProgress * 100); + } + else if (progress.State == PackageInstallProgressState.Installing) + { + record.PercentComplete = (int)(progress.InstallationProgress * 100); + } + + adapter.WriteProgress(record); + }; + + operation.Completed = (context, status) => + { + var record = new ProgressRecord(1, activity, status.ToString()) + { + RecordType = ProgressRecordType.Completed, + }; + + adapter.WriteProgress(record); + adapter.Completed = true; + }; + + System.Console.CancelKeyPress += (sender, e) => + { + operation.Cancel(); + }; + + adapter.Wait(); + return operation.GetResults(); + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseLifecycleCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseLifecycleCommand.cs new file mode 100644 index 0000000000..f2cb6f4cdc --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseLifecycleCommand.cs @@ -0,0 +1,133 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System; + using System.IO; + using System.Management.Automation; + using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Helpers; + + /// + /// This is the base class for commands which operate on a specific package version. + /// + public class BaseLifecycleCommand : BaseFinderCommand + { + private string log; + + /// + /// Gets or sets the package to directly install. + /// + [Alias("InputObject")] + [ValidateNotNull] + [Parameter( + ParameterSetName = Constants.GivenSet, + Position = 0, + ValueFromPipeline = true, + ValueFromPipelineByPropertyName = true)] + public CatalogPackage CatalogPackage { get; set; } + + /// + /// Gets or sets the version to install. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public string Version { get; set; } + + /// + /// Gets or sets the path to the logging file. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public string Log + { + get => this.log; + set + { + string prefix = Path.IsPathRooted(value) + ? string.Empty + : this.SessionState.Path.CurrentFileSystemLocation + @"\"; + + this.log = prefix + value; + } + } + + /// + /// Executes a command targeting a specific package version. + /// + /// The value. + /// The method to call after retrieving the package and version to operate upon. + protected void ExecuteCommand( + CompositeSearchBehavior behavior, + Action callback) + { + var package = this.GetCatalogPackage(behavior); + var version = this.GetPackageVersionId(package); + var confirm = this.ConfirmOperation(package, version); + if (confirm) + { + callback(package, version); + } + } + + private CatalogPackage GetCatalogPackage(CompositeSearchBehavior behavior) + { + if (this.ParameterSetName == Constants.GivenSet) + { + return this.CatalogPackage; + } + else + { + var results = this.FindPackages(behavior, 2); + if (results.Count == 1) + { + return results[0].CatalogPackage; + } + else if (results.Count == 0) + { + throw new RuntimeException(@"No package found matching input criteria."); + } + else + { + throw new Errors.VagueCriteriaException(results[0].CatalogPackage, results[1].CatalogPackage); + } + + } + } + + private PackageVersionId GetPackageVersionId(CatalogPackage package) + { + if (this.Version != null) + { + var versions = package.AvailableVersions; + + for (var i = 0; i < versions.Count; i++) + { + // PackageVersionInfo.DisplayName (?) + bool match = this.Version.Equals( + versions[i].Version, + StringComparison.OrdinalIgnoreCase); + + if (match) + { + return versions[i]; + } + } + + throw new ArgumentException("No version found matching: " + this.Version); + } + else + { + return null; + } + } + + private bool ConfirmOperation(CatalogPackage package, PackageVersionId version) + { + string target = package.ToString(version); + return this.ShouldProcess(target); + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/FindPackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/FindPackageCommand.cs new file mode 100644 index 0000000000..ba14e6c196 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/FindPackageCommand.cs @@ -0,0 +1,33 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System.Management.Automation; + using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Helpers; + + /// + /// Searches configured sources for packages. + /// + [Cmdlet(VerbsCommon.Find, Constants.PackageNoun)] + [OutputType(typeof(MatchResult))] + public sealed class FindPackageCommand : BaseFinderExtendedCommand + { + /// + /// Searches for configured sources for packages. + /// + protected override void ProcessRecord() + { + base.ProcessRecord(); + var results = this.FindPackages(CompositeSearchBehavior.RemotePackagesFromRemoteCatalogs); + for (var i = 0; i < results.Count; i++) + { + this.WriteObject(results[i]); + } + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/GetPackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/GetPackageCommand.cs new file mode 100644 index 0000000000..4a685c1934 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/GetPackageCommand.cs @@ -0,0 +1,33 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System.Management.Automation; + using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Helpers; + + /// + /// Searches configured sources for packages. + /// + [Cmdlet(VerbsCommon.Get, Constants.PackageNoun)] + [OutputType(typeof(CatalogPackage))] + public sealed class GetPackageCommand : BaseFinderExtendedCommand + { + /// + /// Searches for configured sources for packages. + /// + protected override void ProcessRecord() + { + base.ProcessRecord(); + var results = this.FindPackages(CompositeSearchBehavior.LocalCatalogs); + for (var i = 0; i < results.Count; i++) + { + this.WriteObject(results[i].CatalogPackage); + } + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/GetSourceCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/GetSourceCommand.cs new file mode 100644 index 0000000000..e4f043557e --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/GetSourceCommand.cs @@ -0,0 +1,43 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Helpers; + + /// + /// Retrieves the list of configured sources. + /// + [Cmdlet(VerbsCommon.Get, Constants.SourceNoun)] + [OutputType(typeof(PackageCatalogReference))] + public sealed class GetSourceCommand : BaseClientCommand + { + /// + /// Gets or sets the name of the source to retrieve. + /// + [Parameter( + Position = 0, + ValueFromPipeline = true, + ValueFromPipelineByPropertyName = true)] + public string Name { get; set; } + + /// + /// Returns the list of configured sources. + /// + protected override void ProcessRecord() + { + base.ProcessRecord(); + var results = GetPackageCatalogReferences(this.Name); + for (var i = 0; i < results.Count; i++) + { + this.WriteObject(results[i]); + } + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs new file mode 100644 index 0000000000..40f751378d --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs @@ -0,0 +1,98 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +#pragma warning disable SA1200 // Using directives should be placed correctly +using Windows.System; +#pragma warning restore SA1200 // Using directives should be placed correctly + +namespace Microsoft.WinGet.Client.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Helpers; + + /// + /// Installs a package from the pipeline or from a configured source. + /// + [Cmdlet( + VerbsLifecycle.Install, + Constants.PackageNoun, + DefaultParameterSetName = Constants.FoundSet, + SupportsShouldProcess = true)] + [OutputType(typeof(InstallResult))] + public sealed class InstallPackageCommand : BaseInstallCommand + { + private ProcessorArchitecture architecture; + private bool architectureGiven; + + /// + /// Gets or sets the scope to install the application under. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public PackageInstallScope Scope { get; set; } + + /// + /// Gets or sets the architecture of the application to be installed. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public ProcessorArchitecture Architecture + { + get => this.architecture; + set + { + this.architectureGiven = true; + this.architecture = value; + } + } + + /// + /// Prepares the command to install a package. + /// + protected override void BeginProcessing() + { + base.BeginProcessing(); + this.architectureGiven = false; + } + + /// + /// Installs a package from the pipeline or from a configured source. + /// + protected override void ProcessRecord() + { + base.ProcessRecord(); + this.ExecuteCommand(CompositeSearchBehavior.RemotePackagesFromRemoteCatalogs, (package, version) => + { + var options = this.GetInstallOptions(version); + var results = this.InstallPackage(package, options); + this.WriteObject(results); + }); + } + + /// + protected override InstallOptions GetInstallOptions(PackageVersionId version) + { + var options = base.GetInstallOptions(version); + + if (this.architectureGiven) + { + options.AllowedArchitectures.Clear(); + options.AllowedArchitectures.Add(this.architecture); + } + + options.PackageInstallScope = this.Scope; + return options; + } + + private InstallResult InstallPackage( + CatalogPackage package, + InstallOptions options) + { + var operation = PackageManager.Value.InstallPackageAsync(package, options); + return this.RegisterCallbacksAndWait(operation, $"Installing '{package.Name}'"); + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs new file mode 100644 index 0000000000..626db745b1 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs @@ -0,0 +1,102 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Helpers; + + /// + /// Uninstalls a package from the local system. + /// + [Cmdlet( + VerbsLifecycle.Uninstall, + Constants.PackageNoun, + DefaultParameterSetName = Constants.FoundSet, + SupportsShouldProcess = true)] + [OutputType(typeof(UninstallResult))] + public sealed class UninstallPackageCommand : BaseLifecycleCommand + { + /// + /// Gets or sets the desired mode for the uninstallation process. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public PackageUninstallMode Mode { get; set; } = PackageUninstallMode.Default; + + /// + /// Uninstalls a package from the local system. + /// + protected override void ProcessRecord() + { + this.ExecuteCommand(CompositeSearchBehavior.LocalCatalogs, (package, version) => + { + var options = this.GetUninstallOptions(version); + var results = this.UninstallPackage(package, options); + this.WriteObject(results); + }); + } + + private UninstallOptions GetUninstallOptions(PackageVersionId version) + { + var options = ComObjectFactory.Value.CreateUninstallOptions(); + + if (this.Log != null) + { + options.LogOutputPath = this.Log; + } + + options.PackageUninstallMode = this.Mode; + + if (version != null) + { + options.PackageVersionId = version; + } + + return options; + } + + private UninstallResult UninstallPackage( + CatalogPackage package, + UninstallOptions options) + { + string activity = $"Uninstalling '{package.Name}'"; + + var operation = PackageManager.Value.UninstallPackageAsync(package, options); + var adapter = new WriteProgressAdapter(this); + + operation.Progress = (context, progress) => + { + var record = new ProgressRecord(1, activity, progress.State.ToString()) + { + RecordType = ProgressRecordType.Processing, + }; + + adapter.WriteProgress(record); + }; + + operation.Completed = (context, status) => + { + var record = new ProgressRecord(1, activity, status.ToString()) + { + RecordType = ProgressRecordType.Completed, + }; + + adapter.WriteProgress(record); + adapter.Completed = true; + }; + + Console.CancelKeyPress += (sender, e) => + { + operation.Cancel(); + }; + + adapter.Wait(); + return operation.GetResults(); + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs new file mode 100644 index 0000000000..25aec9c9e8 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs @@ -0,0 +1,63 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Helpers; + + /// + /// This commands updates a package from the pipeline or from the local system. + /// + [Cmdlet( + VerbsData.Update, + Constants.PackageNoun, + DefaultParameterSetName = Constants.FoundSet, + SupportsShouldProcess = true)] + [OutputType(typeof(InstallResult))] + public sealed class UpdatePackageCommand : BaseInstallCommand + { + /// + /// Gets or sets a value indicating whether updating to an unknown version is allowed. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public SwitchParameter IncludeUnknown { get; set; } + + /// + /// Updates a package from the pipeline or from the local system. + /// + protected override void ProcessRecord() + { + base.ProcessRecord(); + this.ExecuteCommand(CompositeSearchBehavior.LocalCatalogs, (package, version) => + { + var options = this.GetInstallOptions(version); + var results = this.UpgradePackage(package, options); + this.WriteObject(results); + }); + } + + /// + protected override InstallOptions GetInstallOptions(PackageVersionId version) + { + var options = base.GetInstallOptions(version); + + options.AllowUpgradeToUnknownVersion = this.IncludeUnknown.ToBool(); + + return options; + } + + private InstallResult UpgradePackage( + CatalogPackage package, + InstallOptions options) + { + var operation = PackageManager.Value.UpgradePackageAsync(package, options); + return this.RegisterCallbacksAndWait(operation, $"Updating '{package.Name}'"); + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Crescendo.json b/src/PowerShell/Microsoft.WinGet.Client/Crescendo.json new file mode 100644 index 0000000000..5fecbb1fc0 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Crescendo.json @@ -0,0 +1,127 @@ +{ + "$schema": "https://aka.ms/PowerShell/Crescendo/Schemas/2021-11", + "Commands": [ + { + "Verb": "Get", + "Noun": "WinGetVersion", + "Platform": [ + "Windows" + ], + "OriginalName": "winget.exe", + "OriginalCommandElements": [ + "--version" + ] + }, + { + "Verb": "Enable", + "Noun": "WinGetLocalManifest", + "Platform": [ + "Windows" + ], + "OriginalName": "winget.exe", + "OriginalCommandElements": [ + "settings", + "--enable", + "LocalManifestFiles" + ] + }, + { + "Verb": "Disable", + "Noun": "WinGetLocalManifest", + "Platform": [ + "Windows" + ], + "OriginalName": "winget.exe", + "OriginalCommandElements": [ + "settings", + "--disable", + "LocalManifestFiles" + ] + }, + { + "Verb": "Add", + "Noun": "WinGetSource", + "Platform": [ + "Windows" + ], + "OriginalName": "winget.exe", + "OriginalCommandElements": [ + "source", + "add" + ], + "Parameters": [ + { + "Name": "Name", + "OriginalName": "--name", + "Mandatory": true, + "ParameterType": "string", + "ValueFromPipelineByPropertyName": true, + "Position": 0 + }, + { + "Name": "Argument", + "OriginalName": "--arg", + "Mandatory": true, + "ParameterType": "string", + "ValueFromPipelineByPropertyName": true, + "Position": 1 + }, + { + "Name": "Type", + "OriginalName": "--type", + "Mandatory": false, + "ParameterType": "string", + "ValueFromPipelineByPropertyName": true, + "Position": 2 + } + ] + }, + { + "Verb": "Remove", + "Noun": "WinGetSource", + "Platform": [ + "Windows" + ], + "OriginalName": "winget.exe", + "OriginalCommandElements": [ + "source", + "remove" + ], + "Parameters": [ + { + "Name": "Name", + "OriginalName": "--name", + "Mandatory": true, + "ParameterType": "string", + "ValueFromPipeline": true, + "ValueFromPipelineByPropertyName": true, + "Position": 0 + } + ] + }, + { + "Verb": "Reset", + "Noun": "WinGetSource", + "Platform": [ + "Windows" + ], + "OriginalName": "winget.exe", + "OriginalCommandElements": [ + "source", + "reset", + "--force" + ], + "Parameters": [ + { + "Name": "Name", + "OriginalName": "--name", + "Mandatory": false, + "ParameterType": "string", + "ValueFromPipeline": true, + "ValueFromPipelineByPropertyName": true, + "Position": 0 + } + ] + } + ] +} \ No newline at end of file diff --git a/src/PowerShell/Microsoft.WinGet.Client/Errors/FindPackagesException.cs b/src/PowerShell/Microsoft.WinGet.Client/Errors/FindPackagesException.cs new file mode 100644 index 0000000000..1b95514dc7 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Errors/FindPackagesException.cs @@ -0,0 +1,33 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Errors +{ + using System; + using Microsoft.Management.Deployment; + + /// + /// Raised when there is an error searching for packages. + /// + [Serializable] + public class FindPackagesException : Exception + { + /// + /// Initializes a new instance of the class. + /// + /// A value. + public FindPackagesException(FindPackagesResultStatus status) + : base(@"There was an error searching for packages.") + { + this.Status = status; + } + + /// + /// Gets or sets the error status. + /// + public FindPackagesResultStatus Status { get; set; } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Errors/VagueCriteriaException.cs b/src/PowerShell/Microsoft.WinGet.Client/Errors/VagueCriteriaException.cs new file mode 100644 index 0000000000..4320222f2c --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Errors/VagueCriteriaException.cs @@ -0,0 +1,40 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Errors +{ + using System; + using Microsoft.Management.Deployment; + + /// + /// Raised when search criteria for installing or updating a package is too vague. + /// + [Serializable] + public class VagueCriteriaException : Exception + { + /// + /// Initializes a new instance of the class. + /// + /// The first instance. + /// The second instance. + public VagueCriteriaException(CatalogPackage one, CatalogPackage two) + : base($"Both '{one.ToString(null)}' and '{two.ToString(null)}' match the input criteria. Please refine the input.") + { + this.PackageOne = one; + this.PackageTwo = two; + } + + /// + /// Gets or sets the first conflicting package. + /// + public CatalogPackage PackageOne { get; set; } + + /// + /// Gets or sets the second conflicting package. + /// + public CatalogPackage PackageTwo { get; set; } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Factories/ComObjectFactory.cs b/src/PowerShell/Microsoft.WinGet.Client/Factories/ComObjectFactory.cs new file mode 100644 index 0000000000..e2332b7745 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Factories/ComObjectFactory.cs @@ -0,0 +1,101 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Factories +{ + using System; + using Microsoft.Management.Deployment; + +#if NET + using System.Runtime.InteropServices; + using WinRT; +#endif + + /// + /// Constructs instances of classes from the namespace. + /// + public class ComObjectFactory + { + private static readonly Guid PackageManagerCLSID = Guid.Parse("C53A4F16-787E-42A4-B304-29EFFB4BF597"); + private static readonly Guid FindPackagesOptionsCLSID = Guid.Parse("572DED96-9C60-4526-8F92-EE7D91D38C1A"); + private static readonly Guid CreateCompositePackageCatalogOptionsCLSID = Guid.Parse("526534B8-7E46-47C8-8416-B1685C327D37"); + private static readonly Guid InstallOptionsCLSID = Guid.Parse("1095F097-EB96-453B-B4E6-1613637F3B14"); + private static readonly Guid UninstallOptionsCLSID = Guid.Parse("E1D9A11E-9F85-4D87-9C17-2B93143ADB8D"); + private static readonly Guid PackageMatchFilterCLSID = Guid.Parse("D02C9DAF-99DC-429C-B503-4E504E4AB000"); + + private static readonly Type PackageManagerType = Type.GetTypeFromCLSID(PackageManagerCLSID); + private static readonly Type FindPackagesOptionsType = Type.GetTypeFromCLSID(FindPackagesOptionsCLSID); + private static readonly Type CreateCompositePackageCatalogOptionsType = Type.GetTypeFromCLSID(CreateCompositePackageCatalogOptionsCLSID); + private static readonly Type InstallOptionsType = Type.GetTypeFromCLSID(InstallOptionsCLSID); + private static readonly Type UninstallOptionsType = Type.GetTypeFromCLSID(UninstallOptionsCLSID); + private static readonly Type PackageMatchFilterType = Type.GetTypeFromCLSID(PackageMatchFilterCLSID); + + /// + /// Creates an instance of the class. + /// + /// A instance. + public virtual PackageManager CreatePackageManager() + { + return Create(PackageManagerType); + } + + /// + /// Creates an instance of the class. + /// + /// A instance. + public virtual FindPackagesOptions CreateFindPackagesOptions() + { + return Create(FindPackagesOptionsType); + } + + /// + /// Creates an instance of the class. + /// + /// A instance. + public virtual CreateCompositePackageCatalogOptions CreateCreateCompositePackageCatalogOptions() + { + return Create(CreateCompositePackageCatalogOptionsType); + } + + /// + /// Creates an instance of the class. + /// + /// An instance. + public virtual InstallOptions CreateInstallOptions() + { + return Create(InstallOptionsType); + } + + /// + /// Creates an instance of the class. + /// + /// A instance. + public virtual UninstallOptions CreateUninstallOptions() + { + return Create(UninstallOptionsType); + } + + /// + /// Creates an instance of the class. + /// + /// A instance. + public virtual PackageMatchFilter CreatePackageMatchFilter() + { + return Create(PackageMatchFilterType); + } + + private static T Create(Type type) + { + object instance = Activator.CreateInstance(type); +#if NET + IntPtr pointer = Marshal.GetIUnknownForObject(instance); + return MarshalInterface.FromAbi(pointer); +#else + return (T)instance; +#endif + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Format.ps1xml b/src/PowerShell/Microsoft.WinGet.Client/Format.ps1xml new file mode 100644 index 0000000000..77aab233b0 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Format.ps1xml @@ -0,0 +1,135 @@ + + + + + Microsoft.Management.Deployment.MatchResult + + Microsoft.Management.Deployment.MatchResult + + + + + 32 + + + + 32 + + + + + + + + + + + + + + + + + $_.CatalogPackage.Name + + + $_.CatalogPackage.Id + + + $_.CatalogPackage.DefaultInstallVersion.Version + + + '{0}: {1}' -f $_.MatchCriteria.Field,$_.MatchCriteria.Value + + + $_.CatalogPackage.DefaultInstallVersion.PackageCatalog.Info.Name + + + + + + + + Microsoft.Management.Deployment.PackageCatalogReference + + Microsoft.Management.Deployment.PackageCatalogReference + + + + + 32 + + + + + + + + + + + + + + $_.Info.Name + + + $_.Info.Type + + + $_.Info.Argument + + + + + + + + Microsoft.Management.Deployment.CatalogPackage + + Microsoft.Management.Deployment.CatalogPackage + + + + + 32 + + + + + + + + + + + + + + + + + + + + $_.Name + + + $_.Id + + + $_.InstalledVersion.Version + + + if ($_.IsUpdateAvailable) { $_.AvailableVersions[0].Version } + + + $_.DefaultInstallVersion.PackageCatalog.Info.Name + + + + + + + + \ No newline at end of file diff --git a/src/PowerShell/Microsoft.WinGet.Client/Helpers/CatalogPackageExtensions.cs b/src/PowerShell/Microsoft.WinGet.Client/Helpers/CatalogPackageExtensions.cs new file mode 100644 index 0000000000..4bb74fed0a --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Helpers/CatalogPackageExtensions.cs @@ -0,0 +1,38 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.Management.Deployment +{ + /// + /// Extensions for the class. + /// + public static class CatalogPackageExtensions + { + /// + /// Converts a to a string with the specified version. + /// + /// A instance. + /// A instance. If null, the latest available version is used. + /// A instance. + public static string ToString( + this CatalogPackage package, + PackageVersionId version) + { + if ((version != null) || (package.AvailableVersions.Count > 0)) + { + string versionString = (version is null) + ? package.AvailableVersions[0].Version + : version.Version; + + return $"{package.Name} [{package.Id}] Version {versionString}"; + } + else + { + return $"{package.Name} [{package.Id}]"; + } + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Helpers/Constants.cs b/src/PowerShell/Microsoft.WinGet.Client/Helpers/Constants.cs new file mode 100644 index 0000000000..e3e73cf6e1 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Helpers/Constants.cs @@ -0,0 +1,46 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Helpers +{ + using Microsoft.Management.Deployment; + + /// + /// This class contains all of the configurable constants for this project. + /// + public static class Constants + { + /// + /// The noun analogue of the class. Changing this will alter the names of the related commands. + /// + public const string PackageNoun = "WinGetPackage"; + + /// + /// The noun analogue of the class. Changing this will alter the names of the related commands. + /// + public const string SourceNoun = "WinGetSource"; + + /// + /// If a command allows the specification of the maximum number of results to return, this is the lower bound for that value. + /// + public const uint CountLowerBound = 1; + + /// + /// If a command allows the specification of the maximum number of results to return, this is the upper bound for that value. + /// + public const uint CountUpperBound = 1000; + + /// + /// This is the name of the parameter set for when a package was supplied. + /// + public const string GivenSet = "GivenSet"; + + /// + /// This is the name of the parameter set for when a package was not supplied. + /// + public const string FoundSet = "FoundSet"; + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Helpers/WriteProgressAdapter.cs b/src/PowerShell/Microsoft.WinGet.Client/Helpers/WriteProgressAdapter.cs new file mode 100644 index 0000000000..a23afd1e4b --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Helpers/WriteProgressAdapter.cs @@ -0,0 +1,92 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Helpers +{ + using System; + using System.Collections.Generic; + using System.Management.Automation; + using System.Threading; + + /// + /// Marshals calls to back to the main thread. + /// + public class WriteProgressAdapter + { + private readonly AutoResetEvent resetEvent = new AutoResetEvent(false); + private readonly Queue records = new Queue(); + private readonly Cmdlet cmdlet; + private volatile bool completed = false; + + /// + /// Initializes a new instance of the class. + /// + /// A instance. + public WriteProgressAdapter(Cmdlet cmdlet) + { + this.cmdlet = cmdlet; + } + + /// + /// Sets a value indicating whether the asynchronous operation is finished and the main thread can continue. + /// + public bool Completed + { + set + { + this.completed = value; + if (value) + { + this.resetEvent.Set(); + } + } + } + + /// + /// This should be called on the main thread to wait for the asynchronous operation to complete. + /// + public void Wait() + { + while (!this.completed) + { + lock (this.records) + { + this.Flush(); + } + + this.resetEvent.WaitOne(); + } + + this.Flush(); + } + + /// + /// This is an analogue of the function. + /// + /// A instance. + public void WriteProgress(ProgressRecord record) + { + if (record != null) + { + lock (this.records) + { + this.records.Enqueue(record); + } + + this.resetEvent.Set(); + } + } + + private void Flush() + { + while (this.records.Count > 0) + { + ProgressRecord record = this.records.Dequeue(); + this.cmdlet.WriteProgress(record); + } + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj new file mode 100644 index 0000000000..b7ba692485 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj @@ -0,0 +1,38 @@ + + + + net6.0-windows10.0.22000.0;net461 + ARM;ARM64;x64;x86 + true + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + Microsoft.Management.Deployment + 10.0.22000.0 + + + \ No newline at end of file diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 new file mode 100644 index 0000000000..0d20f7aef8 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 @@ -0,0 +1,171 @@ +# +# Module manifest for module 'Microsoft.WinGet.Client' +# +# Generated by: Microsoft Corporation +# +# Generated on: 7/7/2022 +# + +@{ + + # Script module or binary module file associated with this manifest. + RootModule = 'Microsoft.WinGet.Client.psm1' + + # Version number of this module. + ModuleVersion = '0.0.1' + + # Supported PSEditions + CompatiblePSEditions = 'Desktop', 'Core' + + # ID used to uniquely identify this module + GUID = 'e11157e2-cd24-4250-83b8-c6654ea4926a' + + # Author of this module + Author = 'Microsoft Corporation' + + # Company or vendor of this module + CompanyName = 'Microsoft Corporation' + + # Copyright statement for this module + Copyright = '(c) Microsoft Corporation. All rights reserved.' + + # Description of the functionality provided by this module + Description = 'PowerShell Module for the Windows Package Manager Client.' + + # Minimum version of the PowerShell engine required by this module + PowerShellVersion = '5.1.0' + + # Name of the PowerShell host required by this module + # PowerShellHostName = '' + + # Minimum version of the PowerShell host required by this module + # PowerShellHostVersion = '' + + # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # DotNetFrameworkVersion = '' + + # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # ClrVersion = '' + + # Processor architecture (None, X86, Amd64) required by this module + # ProcessorArchitecture = '' + + # Modules that must be imported into the global environment prior to importing this module + # RequiredModules = @() + + # Assemblies that must be loaded prior to importing this module + # RequiredAssemblies = @() + + # Script files (.ps1) that are run in the caller's environment prior to importing this module. + # ScriptsToProcess = @() + + # Type files (.ps1xml) to be loaded when importing this module + # TypesToProcess = @() + + # Format files (.ps1xml) to be loaded when importing this module + FormatsToProcess = 'Format.ps1xml' + + # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess + NestedModules = if ($env:PROCESSOR_ARCHITECTURE -like 'amd64') { + "x64\$PSEdition\Microsoft.WinGet.Client.dll" + } + elseif ($env:PROCESSOR_ARCHITECTURE -like 'x86') { + "x86\$PSEdition\Microsoft.WinGet.Client.dll" + } + elseif ($env:PROCESSOR_ARCHITECTURE -like 'arm64') { + "ARM64\$PSEdition\Microsoft.WinGet.Client.dll" + } + else { + "ARM\$PSEdition\Microsoft.WinGet.Client.dll" + } + + # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. + FunctionsToExport = @( + 'Get-WinGetVersion' + 'Get-WinGetVersion', + 'Enable-WinGetLocalManifest', + 'Disable-WinGetLocalManifest', + 'Add-WinGetSource', + 'Remove-WinGetSource', + 'Reset-WinGetSource' + ) + + # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. + CmdletsToExport = @( + 'Find-WinGetPackage', + 'Get-WinGetPackage', + 'Get-WinGetSource', + 'Install-WinGetPackage', + 'Uninstall-WinGetPackage', + 'Update-WinGetPackage' + ) + + # Variables to export from this module + # VariablesToExport = @() + + # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. + AliasesToExport = @() + + # DSC resources to export from this module + # DscResourcesToExport = @() + + # List of all modules packaged with this module + # ModuleList = @() + + # List of all files packaged with this module + # FileList = @() + + # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. + PrivateData = @{ + + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + Tags = @( + 'CrescendoBuilt', + 'PSEdition_Desktop', + 'PSEdition_Core', + 'Windows', + 'WindowsPackageManager' + ) + + # A URL to the license for this module. + # LicenseUri = '' + + # A URL to the main website for this project. + ProjectUri = 'https://github.com/microsoft/winget-cli' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + # ReleaseNotes = '' + + # Prerelease string of this module + Prerelease = 'alpha' + + # Flag to indicate whether the module requires explicit user acceptance for install/update/save + # RequireLicenseAcceptance = $false + + # External dependent modules of this module + # ExternalModuleDependencies = @() + + } # End of PSData hashtable + + + # CrescendoVersion + CrescendoVersion = '1.0.0' + + # CrescendoGenerated + CrescendoGenerated = '07/07/2022 00:00:00' + + } # End of PrivateData hashtable + + # HelpInfo URI of this module + # HelpInfoURI = '' + + # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. + # DefaultCommandPrefix = '' + +} + diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psm1 b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psm1 new file mode 100644 index 0000000000..1583e87fa6 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psm1 @@ -0,0 +1,755 @@ +# Module created by Microsoft.PowerShell.Crescendo +class PowerShellCustomFunctionAttribute : System.Attribute { + [bool]$RequiresElevation + [string]$Source + PowerShellCustomFunctionAttribute() { $this.RequiresElevation = $false; $this.Source = "Microsoft.PowerShell.Crescendo" } + PowerShellCustomFunctionAttribute([bool]$rElevation) { + $this.RequiresElevation = $rElevation + $this.Source = "Microsoft.PowerShell.Crescendo" + } +} + + + +function Get-WinGetVersion +{ +[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] +[CmdletBinding()] + +param( ) + +BEGIN { + $__PARAMETERMAP = @{} + $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } +} + +PROCESS { + $__boundParameters = $PSBoundParameters + $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name + $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) + $__commandArgs = @() + $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) + if ($__boundParameters["Debug"]){wait-debugger} + $__commandArgs += '--version' + foreach ($paramName in $__boundParameters.Keys| + Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| + Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { + $value = $__boundParameters[$paramName] + $param = $__PARAMETERMAP[$paramName] + if ($param) { + if ($value -is [switch]) { + if ($value.IsPresent) { + if ($param.OriginalName) { $__commandArgs += $param.OriginalName } + } + elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } + } + elseif ( $param.NoGap ) { + $pFmt = "{0}{1}" + if($value -match "\s") { $pFmt = "{0}""{1}""" } + $__commandArgs += $pFmt -f $param.OriginalName, $value + } + else { + if($param.OriginalName) { $__commandArgs += $param.OriginalName } + $__commandArgs += $value | Foreach-Object {$_} + } + } + } + $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} + if ($__boundParameters["Debug"]){wait-debugger} + if ( $__boundParameters["Verbose"]) { + Write-Verbose -Verbose -Message winget.exe + $__commandArgs | Write-Verbose -Verbose + } + $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] + if (! $__handlerInfo ) { + $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present + } + $__handler = $__handlerInfo.Handler + if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { + # check for the application and throw if it cannot be found + if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { + throw "Cannot find executable 'winget.exe'" + } + if ( $__handlerInfo.StreamOutput ) { + & "winget.exe" $__commandArgs | & $__handler + } + else { + $result = & "winget.exe" $__commandArgs + & $__handler $result + } + } + } # end PROCESS + +<# +.SYNOPSIS +Windows Package Manager (Preview) v1.3.1391-preview +Copyright (c) Microsoft Corporation. All rights reserved. + +The winget command line utility enables installing applications and other packages from the command line. + +usage: winget [] [] + +The following commands are available: + install Installs the given package + show Shows information about a package + source Manage sources of packages + search Find and show basic info of packages + list Display installed packages + upgrade Shows and performs available upgrades + uninstall Uninstalls the given package + hash Helper to hash installer files + validate Validates a manifest file + settings Open settings or set administrator settings + features Shows the status of experimental features + export Exports a list of the installed packages + import Installs all the packages in a file + +For more details on a specific command, pass it the help argument. [-?] + +The following options are available: + -v,--version Display the version of the tool + --info Display general info of the tool + +More help can be found at: https://aka.ms/winget-command-help + +.DESCRIPTION See help for winget.exe + +#> +} + + + + +function Enable-WinGetLocalManifest +{ +[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] +[CmdletBinding()] + +param( ) + +BEGIN { + $__PARAMETERMAP = @{} + $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } +} + +PROCESS { + $__boundParameters = $PSBoundParameters + $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name + $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) + $__commandArgs = @() + $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) + if ($__boundParameters["Debug"]){wait-debugger} + $__commandArgs += 'settings' + $__commandArgs += '--enable' + $__commandArgs += 'LocalManifestFiles' + foreach ($paramName in $__boundParameters.Keys| + Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| + Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { + $value = $__boundParameters[$paramName] + $param = $__PARAMETERMAP[$paramName] + if ($param) { + if ($value -is [switch]) { + if ($value.IsPresent) { + if ($param.OriginalName) { $__commandArgs += $param.OriginalName } + } + elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } + } + elseif ( $param.NoGap ) { + $pFmt = "{0}{1}" + if($value -match "\s") { $pFmt = "{0}""{1}""" } + $__commandArgs += $pFmt -f $param.OriginalName, $value + } + else { + if($param.OriginalName) { $__commandArgs += $param.OriginalName } + $__commandArgs += $value | Foreach-Object {$_} + } + } + } + $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} + if ($__boundParameters["Debug"]){wait-debugger} + if ( $__boundParameters["Verbose"]) { + Write-Verbose -Verbose -Message winget.exe + $__commandArgs | Write-Verbose -Verbose + } + $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] + if (! $__handlerInfo ) { + $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present + } + $__handler = $__handlerInfo.Handler + if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { + # check for the application and throw if it cannot be found + if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { + throw "Cannot find executable 'winget.exe'" + } + if ( $__handlerInfo.StreamOutput ) { + & "winget.exe" $__commandArgs | & $__handler + } + else { + $result = & "winget.exe" $__commandArgs + & $__handler $result + } + } + } # end PROCESS + +<# +.SYNOPSIS +Windows Package Manager (Preview) v1.3.1391-preview +Copyright (c) Microsoft Corporation. All rights reserved. + +The winget command line utility enables installing applications and other packages from the command line. + +usage: winget [] [] + +The following commands are available: + install Installs the given package + show Shows information about a package + source Manage sources of packages + search Find and show basic info of packages + list Display installed packages + upgrade Shows and performs available upgrades + uninstall Uninstalls the given package + hash Helper to hash installer files + validate Validates a manifest file + settings Open settings or set administrator settings + features Shows the status of experimental features + export Exports a list of the installed packages + import Installs all the packages in a file + +For more details on a specific command, pass it the help argument. [-?] + +The following options are available: + -v,--version Display the version of the tool + --info Display general info of the tool + +More help can be found at: https://aka.ms/winget-command-help + +.DESCRIPTION See help for winget.exe + +#> +} + + + + +function Disable-WinGetLocalManifest +{ +[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] +[CmdletBinding()] + +param( ) + +BEGIN { + $__PARAMETERMAP = @{} + $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } +} + +PROCESS { + $__boundParameters = $PSBoundParameters + $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name + $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) + $__commandArgs = @() + $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) + if ($__boundParameters["Debug"]){wait-debugger} + $__commandArgs += 'settings' + $__commandArgs += '--disable' + $__commandArgs += 'LocalManifestFiles' + foreach ($paramName in $__boundParameters.Keys| + Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| + Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { + $value = $__boundParameters[$paramName] + $param = $__PARAMETERMAP[$paramName] + if ($param) { + if ($value -is [switch]) { + if ($value.IsPresent) { + if ($param.OriginalName) { $__commandArgs += $param.OriginalName } + } + elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } + } + elseif ( $param.NoGap ) { + $pFmt = "{0}{1}" + if($value -match "\s") { $pFmt = "{0}""{1}""" } + $__commandArgs += $pFmt -f $param.OriginalName, $value + } + else { + if($param.OriginalName) { $__commandArgs += $param.OriginalName } + $__commandArgs += $value | Foreach-Object {$_} + } + } + } + $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} + if ($__boundParameters["Debug"]){wait-debugger} + if ( $__boundParameters["Verbose"]) { + Write-Verbose -Verbose -Message winget.exe + $__commandArgs | Write-Verbose -Verbose + } + $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] + if (! $__handlerInfo ) { + $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present + } + $__handler = $__handlerInfo.Handler + if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { + # check for the application and throw if it cannot be found + if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { + throw "Cannot find executable 'winget.exe'" + } + if ( $__handlerInfo.StreamOutput ) { + & "winget.exe" $__commandArgs | & $__handler + } + else { + $result = & "winget.exe" $__commandArgs + & $__handler $result + } + } + } # end PROCESS + +<# +.SYNOPSIS +Windows Package Manager (Preview) v1.3.1391-preview +Copyright (c) Microsoft Corporation. All rights reserved. + +The winget command line utility enables installing applications and other packages from the command line. + +usage: winget [] [] + +The following commands are available: + install Installs the given package + show Shows information about a package + source Manage sources of packages + search Find and show basic info of packages + list Display installed packages + upgrade Shows and performs available upgrades + uninstall Uninstalls the given package + hash Helper to hash installer files + validate Validates a manifest file + settings Open settings or set administrator settings + features Shows the status of experimental features + export Exports a list of the installed packages + import Installs all the packages in a file + +For more details on a specific command, pass it the help argument. [-?] + +The following options are available: + -v,--version Display the version of the tool + --info Display general info of the tool + +More help can be found at: https://aka.ms/winget-command-help + +.DESCRIPTION See help for winget.exe + +#> +} + + + + +function Add-WinGetSource +{ +[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] +[CmdletBinding()] + +param( +[Parameter(Position=0,ValueFromPipelineByPropertyName=$true,Mandatory=$true)] +[string]$Name, +[Parameter(Position=1,ValueFromPipelineByPropertyName=$true,Mandatory=$true)] +[string]$Argument, +[Parameter(Position=2,ValueFromPipelineByPropertyName=$true)] +[string]$Type + ) + +BEGIN { + $__PARAMETERMAP = @{ + Name = @{ + OriginalName = '--name' + OriginalPosition = '0' + Position = '0' + ParameterType = 'string' + ApplyToExecutable = $False + NoGap = $False + } + Argument = @{ + OriginalName = '--arg' + OriginalPosition = '0' + Position = '1' + ParameterType = 'string' + ApplyToExecutable = $False + NoGap = $False + } + Type = @{ + OriginalName = '--type' + OriginalPosition = '0' + Position = '2' + ParameterType = 'string' + ApplyToExecutable = $False + NoGap = $False + } + } + + $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } +} + +PROCESS { + $__boundParameters = $PSBoundParameters + $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name + $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) + $__commandArgs = @() + $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) + if ($__boundParameters["Debug"]){wait-debugger} + $__commandArgs += 'source' + $__commandArgs += 'add' + foreach ($paramName in $__boundParameters.Keys| + Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| + Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { + $value = $__boundParameters[$paramName] + $param = $__PARAMETERMAP[$paramName] + if ($param) { + if ($value -is [switch]) { + if ($value.IsPresent) { + if ($param.OriginalName) { $__commandArgs += $param.OriginalName } + } + elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } + } + elseif ( $param.NoGap ) { + $pFmt = "{0}{1}" + if($value -match "\s") { $pFmt = "{0}""{1}""" } + $__commandArgs += $pFmt -f $param.OriginalName, $value + } + else { + if($param.OriginalName) { $__commandArgs += $param.OriginalName } + $__commandArgs += $value | Foreach-Object {$_} + } + } + } + $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} + if ($__boundParameters["Debug"]){wait-debugger} + if ( $__boundParameters["Verbose"]) { + Write-Verbose -Verbose -Message winget.exe + $__commandArgs | Write-Verbose -Verbose + } + $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] + if (! $__handlerInfo ) { + $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present + } + $__handler = $__handlerInfo.Handler + if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { + # check for the application and throw if it cannot be found + if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { + throw "Cannot find executable 'winget.exe'" + } + if ( $__handlerInfo.StreamOutput ) { + & "winget.exe" $__commandArgs | & $__handler + } + else { + $result = & "winget.exe" $__commandArgs + & $__handler $result + } + } + } # end PROCESS + +<# +.SYNOPSIS +Windows Package Manager (Preview) v1.3.1391-preview +Copyright (c) Microsoft Corporation. All rights reserved. + +The winget command line utility enables installing applications and other packages from the command line. + +usage: winget [] [] + +The following commands are available: + install Installs the given package + show Shows information about a package + source Manage sources of packages + search Find and show basic info of packages + list Display installed packages + upgrade Shows and performs available upgrades + uninstall Uninstalls the given package + hash Helper to hash installer files + validate Validates a manifest file + settings Open settings or set administrator settings + features Shows the status of experimental features + export Exports a list of the installed packages + import Installs all the packages in a file + +For more details on a specific command, pass it the help argument. [-?] + +The following options are available: + -v,--version Display the version of the tool + --info Display general info of the tool + +More help can be found at: https://aka.ms/winget-command-help + +.DESCRIPTION See help for winget.exe + +.PARAMETER Name + + + +.PARAMETER Argument + + + +.PARAMETER Type + + + + +#> +} + + + + +function Remove-WinGetSource +{ +[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] +[CmdletBinding()] + +param( +[Parameter(Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Mandatory=$true)] +[string]$Name + ) + +BEGIN { + $__PARAMETERMAP = @{ + Name = @{ + OriginalName = '--name' + OriginalPosition = '0' + Position = '0' + ParameterType = 'string' + ApplyToExecutable = $False + NoGap = $False + } + } + + $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } +} + +PROCESS { + $__boundParameters = $PSBoundParameters + $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name + $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) + $__commandArgs = @() + $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) + if ($__boundParameters["Debug"]){wait-debugger} + $__commandArgs += 'source' + $__commandArgs += 'remove' + foreach ($paramName in $__boundParameters.Keys| + Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| + Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { + $value = $__boundParameters[$paramName] + $param = $__PARAMETERMAP[$paramName] + if ($param) { + if ($value -is [switch]) { + if ($value.IsPresent) { + if ($param.OriginalName) { $__commandArgs += $param.OriginalName } + } + elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } + } + elseif ( $param.NoGap ) { + $pFmt = "{0}{1}" + if($value -match "\s") { $pFmt = "{0}""{1}""" } + $__commandArgs += $pFmt -f $param.OriginalName, $value + } + else { + if($param.OriginalName) { $__commandArgs += $param.OriginalName } + $__commandArgs += $value | Foreach-Object {$_} + } + } + } + $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} + if ($__boundParameters["Debug"]){wait-debugger} + if ( $__boundParameters["Verbose"]) { + Write-Verbose -Verbose -Message winget.exe + $__commandArgs | Write-Verbose -Verbose + } + $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] + if (! $__handlerInfo ) { + $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present + } + $__handler = $__handlerInfo.Handler + if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { + # check for the application and throw if it cannot be found + if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { + throw "Cannot find executable 'winget.exe'" + } + if ( $__handlerInfo.StreamOutput ) { + & "winget.exe" $__commandArgs | & $__handler + } + else { + $result = & "winget.exe" $__commandArgs + & $__handler $result + } + } + } # end PROCESS + +<# +.SYNOPSIS +Windows Package Manager (Preview) v1.3.1391-preview +Copyright (c) Microsoft Corporation. All rights reserved. + +The winget command line utility enables installing applications and other packages from the command line. + +usage: winget [] [] + +The following commands are available: + install Installs the given package + show Shows information about a package + source Manage sources of packages + search Find and show basic info of packages + list Display installed packages + upgrade Shows and performs available upgrades + uninstall Uninstalls the given package + hash Helper to hash installer files + validate Validates a manifest file + settings Open settings or set administrator settings + features Shows the status of experimental features + export Exports a list of the installed packages + import Installs all the packages in a file + +For more details on a specific command, pass it the help argument. [-?] + +The following options are available: + -v,--version Display the version of the tool + --info Display general info of the tool + +More help can be found at: https://aka.ms/winget-command-help + +.DESCRIPTION See help for winget.exe + +.PARAMETER Name + + + + +#> +} + + + + +function Reset-WinGetSource +{ +[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] +[CmdletBinding()] + +param( +[Parameter(Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)] +[string]$Name + ) + +BEGIN { + $__PARAMETERMAP = @{ + Name = @{ + OriginalName = '--name' + OriginalPosition = '0' + Position = '0' + ParameterType = 'string' + ApplyToExecutable = $False + NoGap = $False + } + } + + $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } +} + +PROCESS { + $__boundParameters = $PSBoundParameters + $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name + $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) + $__commandArgs = @() + $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) + if ($__boundParameters["Debug"]){wait-debugger} + $__commandArgs += 'source' + $__commandArgs += 'reset' + $__commandArgs += '--force' + foreach ($paramName in $__boundParameters.Keys| + Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| + Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { + $value = $__boundParameters[$paramName] + $param = $__PARAMETERMAP[$paramName] + if ($param) { + if ($value -is [switch]) { + if ($value.IsPresent) { + if ($param.OriginalName) { $__commandArgs += $param.OriginalName } + } + elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } + } + elseif ( $param.NoGap ) { + $pFmt = "{0}{1}" + if($value -match "\s") { $pFmt = "{0}""{1}""" } + $__commandArgs += $pFmt -f $param.OriginalName, $value + } + else { + if($param.OriginalName) { $__commandArgs += $param.OriginalName } + $__commandArgs += $value | Foreach-Object {$_} + } + } + } + $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} + if ($__boundParameters["Debug"]){wait-debugger} + if ( $__boundParameters["Verbose"]) { + Write-Verbose -Verbose -Message winget.exe + $__commandArgs | Write-Verbose -Verbose + } + $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] + if (! $__handlerInfo ) { + $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present + } + $__handler = $__handlerInfo.Handler + if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { + # check for the application and throw if it cannot be found + if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { + throw "Cannot find executable 'winget.exe'" + } + if ( $__handlerInfo.StreamOutput ) { + & "winget.exe" $__commandArgs | & $__handler + } + else { + $result = & "winget.exe" $__commandArgs + & $__handler $result + } + } + } # end PROCESS + +<# +.SYNOPSIS +Windows Package Manager (Preview) v1.3.1391-preview +Copyright (c) Microsoft Corporation. All rights reserved. + +The winget command line utility enables installing applications and other packages from the command line. + +usage: winget [] [] + +The following commands are available: + install Installs the given package + show Shows information about a package + source Manage sources of packages + search Find and show basic info of packages + list Display installed packages + upgrade Shows and performs available upgrades + uninstall Uninstalls the given package + hash Helper to hash installer files + validate Validates a manifest file + settings Open settings or set administrator settings + features Shows the status of experimental features + export Exports a list of the installed packages + import Installs all the packages in a file + +For more details on a specific command, pass it the help argument. [-?] + +The following options are available: + -v,--version Display the version of the tool + --info Display general info of the tool + +More help can be found at: https://aka.ms/winget-command-help + +.DESCRIPTION See help for winget.exe + +.PARAMETER Name + + + + +#> +} + + diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Add-WinGetSource.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Add-WinGetSource.md new file mode 100644 index 0000000000..680d9032a9 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Add-WinGetSource.md @@ -0,0 +1,90 @@ +--- +external help file: Microsoft.WinGet.Client-help.xml +Module Name: Microsoft.WinGet.Client +online version: +schema: 2.0.0 +--- + +# Add-WinGetSource + +## SYNOPSIS +{{ Fill in the Synopsis }} + +## SYNTAX + +``` +Add-WinGetSource [-Name] [-Argument] [[-Type] ] [] +``` + +## DESCRIPTION +{{ Fill in the Description }} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Argument +{{ Fill Argument Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Name +{{ Fill Name Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Type +{{ Fill Type Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.String + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Disable-WinGetLocalManifest.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Disable-WinGetLocalManifest.md new file mode 100644 index 0000000000..4f91f7ac51 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Disable-WinGetLocalManifest.md @@ -0,0 +1,45 @@ +--- +external help file: Microsoft.WinGet.Client-help.xml +Module Name: Microsoft.WinGet.Client +online version: +schema: 2.0.0 +--- + +# Disable-WinGetLocalManifest + +## SYNOPSIS +{{ Fill in the Synopsis }} + +## SYNTAX + +``` +Disable-WinGetLocalManifest [] +``` + +## DESCRIPTION +{{ Fill in the Description }} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Enable-WinGetLocalManifest.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Enable-WinGetLocalManifest.md new file mode 100644 index 0000000000..d9966cfeb4 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Enable-WinGetLocalManifest.md @@ -0,0 +1,45 @@ +--- +external help file: Microsoft.WinGet.Client-help.xml +Module Name: Microsoft.WinGet.Client +online version: +schema: 2.0.0 +--- + +# Enable-WinGetLocalManifest + +## SYNOPSIS +{{ Fill in the Synopsis }} + +## SYNTAX + +``` +Enable-WinGetLocalManifest [] +``` + +## DESCRIPTION +{{ Fill in the Description }} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Find-WinGetPackage.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Find-WinGetPackage.md new file mode 100644 index 0000000000..7d36d22b06 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Find-WinGetPackage.md @@ -0,0 +1,188 @@ +--- +external help file: Microsoft.WinGet.Client.dll-Help.xml +Module Name: Microsoft.WinGet.Client +online version: +schema: 2.0.0 +--- + +# Find-WinGetPackage + +## SYNOPSIS +{{ Fill in the Synopsis }} + +## SYNTAX + +``` +Find-WinGetPackage [-Tag ] [-Command ] [-Count ] [-Id ] [-Name ] + [-Moniker ] [-Source ] [[-Query] ] [-Exact] [] +``` + +## DESCRIPTION +{{ Fill in the Description }} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Command +{{ Fill Command Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Count +{{ Fill Count Description }} + +```yaml +Type: UInt32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Exact +{{ Fill Exact Description }} + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Id +{{ Fill Id Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Moniker +{{ Fill Moniker Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Name +{{ Fill Name Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Query +{{ Fill Query Description }} + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Source +{{ Fill Source Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Tag +{{ Fill Tag Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.String + +### System.UInt32 + +### System.String[] + +### System.Management.Automation.SwitchParameter + +## OUTPUTS + +### Microsoft.Management.Deployment.MatchResult + +## NOTES + +## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetPackage.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetPackage.md new file mode 100644 index 0000000000..1b579c8f11 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetPackage.md @@ -0,0 +1,188 @@ +--- +external help file: Microsoft.WinGet.Client.dll-Help.xml +Module Name: Microsoft.WinGet.Client +online version: +schema: 2.0.0 +--- + +# Get-WinGetPackage + +## SYNOPSIS +{{ Fill in the Synopsis }} + +## SYNTAX + +``` +Get-WinGetPackage [-Tag ] [-Command ] [-Count ] [-Id ] [-Name ] + [-Moniker ] [-Source ] [[-Query] ] [-Exact] [] +``` + +## DESCRIPTION +{{ Fill in the Description }} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Command +{{ Fill Command Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Count +{{ Fill Count Description }} + +```yaml +Type: UInt32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Exact +{{ Fill Exact Description }} + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Id +{{ Fill Id Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Moniker +{{ Fill Moniker Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Name +{{ Fill Name Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Query +{{ Fill Query Description }} + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Source +{{ Fill Source Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Tag +{{ Fill Tag Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.String + +### System.UInt32 + +### System.String[] + +### System.Management.Automation.SwitchParameter + +## OUTPUTS + +### Microsoft.Management.Deployment.CatalogPackage + +## NOTES + +## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetSource.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetSource.md new file mode 100644 index 0000000000..fb663b927d --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetSource.md @@ -0,0 +1,61 @@ +--- +external help file: Microsoft.WinGet.Client.dll-Help.xml +Module Name: Microsoft.WinGet.Client +online version: +schema: 2.0.0 +--- + +# Get-WinGetSource + +## SYNOPSIS +{{ Fill in the Synopsis }} + +## SYNTAX + +``` +Get-WinGetSource [[-Name] ] [] +``` + +## DESCRIPTION +{{ Fill in the Description }} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Name +{{ Fill Name Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.String + +## OUTPUTS + +### Microsoft.Management.Deployment.PackageCatalogReference + +## NOTES + +## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetVersion.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetVersion.md new file mode 100644 index 0000000000..7f057a6425 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetVersion.md @@ -0,0 +1,45 @@ +--- +external help file: Microsoft.WinGet.Client-help.xml +Module Name: Microsoft.WinGet.Client +online version: +schema: 2.0.0 +--- + +# Get-WinGetVersion + +## SYNOPSIS +{{ Fill in the Synopsis }} + +## SYNTAX + +``` +Get-WinGetVersion [] +``` + +## DESCRIPTION +{{ Fill in the Description }} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Install-WinGetPackage.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Install-WinGetPackage.md new file mode 100644 index 0000000000..8698c63ea3 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Install-WinGetPackage.md @@ -0,0 +1,344 @@ +--- +external help file: Microsoft.WinGet.Client.dll-Help.xml +Module Name: Microsoft.WinGet.Client +online version: +schema: 2.0.0 +--- + +# Install-WinGetPackage + +## SYNOPSIS +{{ Fill in the Synopsis }} + +## SYNTAX + +### FoundSet (Default) +``` +Install-WinGetPackage [-Scope ] [-Architecture ] + [-Mode ] [-Override ] [-Location ] [-Force] [-Header ] + [-Version ] [-Log ] [-Id ] [-Name ] [-Moniker ] [-Source ] + [[-Query] ] [-Exact] [-WhatIf] [-Confirm] [] +``` + +### GivenSet +``` +Install-WinGetPackage [-Scope ] [-Architecture ] + [-Mode ] [-Override ] [-Location ] [-Force] [-Header ] + [[-CatalogPackage] ] [-Version ] [-Log ] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +{{ Fill in the Description }} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Architecture +{{ Fill Architecture Description }} + +```yaml +Type: ProcessorArchitecture +Parameter Sets: (All) +Aliases: +Accepted values: X86, Arm, X64, Neutral, Arm64, X86OnArm64, Unknown + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -CatalogPackage +{{ Fill CatalogPackage Description }} + +```yaml +Type: CatalogPackage +Parameter Sets: GivenSet +Aliases: InputObject + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Exact +{{ Fill Exact Description }} + +```yaml +Type: SwitchParameter +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Force +{{ Fill Force Description }} + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Header +{{ Fill Header Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Id +{{ Fill Id Description }} + +```yaml +Type: String +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Location +{{ Fill Location Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Log +{{ Fill Log Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Mode +{{ Fill Mode Description }} + +```yaml +Type: PackageInstallMode +Parameter Sets: (All) +Aliases: +Accepted values: Default, Silent, Interactive + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Moniker +{{ Fill Moniker Description }} + +```yaml +Type: String +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Name +{{ Fill Name Description }} + +```yaml +Type: String +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Override +{{ Fill Override Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Query +{{ Fill Query Description }} + +```yaml +Type: String[] +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Scope +{{ Fill Scope Description }} + +```yaml +Type: PackageInstallScope +Parameter Sets: (All) +Aliases: +Accepted values: Any, User, System + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Source +{{ Fill Source Description }} + +```yaml +Type: String +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Version +{{ Fill Version Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Management.Deployment.PackageInstallScope + +### Windows.System.ProcessorArchitecture + +### Microsoft.Management.Deployment.PackageInstallMode + +### System.String + +### System.Management.Automation.SwitchParameter + +### Microsoft.Management.Deployment.CatalogPackage + +### System.String[] + +## OUTPUTS + +### Microsoft.Management.Deployment.InstallResult + +## NOTES + +## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Remove-WinGetSource.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Remove-WinGetSource.md new file mode 100644 index 0000000000..69c60ec458 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Remove-WinGetSource.md @@ -0,0 +1,60 @@ +--- +external help file: Microsoft.WinGet.Client-help.xml +Module Name: Microsoft.WinGet.Client +online version: +schema: 2.0.0 +--- + +# Remove-WinGetSource + +## SYNOPSIS +{{ Fill in the Synopsis }} + +## SYNTAX + +``` +Remove-WinGetSource [-Name] [] +``` + +## DESCRIPTION +{{ Fill in the Description }} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Name +{{ Fill Name Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.String + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Reset-WinGetSource.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Reset-WinGetSource.md new file mode 100644 index 0000000000..41c37987c6 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Reset-WinGetSource.md @@ -0,0 +1,60 @@ +--- +external help file: Microsoft.WinGet.Client-help.xml +Module Name: Microsoft.WinGet.Client +online version: +schema: 2.0.0 +--- + +# Reset-WinGetSource + +## SYNOPSIS +{{ Fill in the Synopsis }} + +## SYNTAX + +``` +Reset-WinGetSource [[-Name] ] [] +``` + +## DESCRIPTION +{{ Fill in the Description }} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Name +{{ Fill Name Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.String + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Uninstall-WinGetPackage.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Uninstall-WinGetPackage.md new file mode 100644 index 0000000000..20e442ce80 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Uninstall-WinGetPackage.md @@ -0,0 +1,245 @@ +--- +external help file: Microsoft.WinGet.Client.dll-Help.xml +Module Name: Microsoft.WinGet.Client +online version: +schema: 2.0.0 +--- + +# Uninstall-WinGetPackage + +## SYNOPSIS +{{ Fill in the Synopsis }} + +## SYNTAX + +### FoundSet (Default) +``` +Uninstall-WinGetPackage [-Mode ] [-Version ] [-Log ] [-Id ] + [-Name ] [-Moniker ] [-Source ] [[-Query] ] [-Exact] [-WhatIf] [-Confirm] + [] +``` + +### GivenSet +``` +Uninstall-WinGetPackage [-Mode ] [[-CatalogPackage] ] [-Version ] + [-Log ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +{{ Fill in the Description }} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -CatalogPackage +{{ Fill CatalogPackage Description }} + +```yaml +Type: CatalogPackage +Parameter Sets: GivenSet +Aliases: InputObject + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Exact +{{ Fill Exact Description }} + +```yaml +Type: SwitchParameter +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Id +{{ Fill Id Description }} + +```yaml +Type: String +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Log +{{ Fill Log Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Mode +{{ Fill Mode Description }} + +```yaml +Type: PackageUninstallMode +Parameter Sets: (All) +Aliases: +Accepted values: Default, Silent, Interactive + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Moniker +{{ Fill Moniker Description }} + +```yaml +Type: String +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Name +{{ Fill Name Description }} + +```yaml +Type: String +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Query +{{ Fill Query Description }} + +```yaml +Type: String[] +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Source +{{ Fill Source Description }} + +```yaml +Type: String +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Version +{{ Fill Version Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Management.Deployment.PackageUninstallMode + +### Microsoft.Management.Deployment.CatalogPackage + +### System.String + +### System.String[] + +### System.Management.Automation.SwitchParameter + +## OUTPUTS + +### Microsoft.Management.Deployment.UninstallResult + +## NOTES + +## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Update-WinGetPackage.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Update-WinGetPackage.md new file mode 100644 index 0000000000..6bcff3edd4 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Update-WinGetPackage.md @@ -0,0 +1,322 @@ +--- +external help file: Microsoft.WinGet.Client.dll-Help.xml +Module Name: Microsoft.WinGet.Client +online version: +schema: 2.0.0 +--- + +# Update-WinGetPackage + +## SYNOPSIS +{{ Fill in the Synopsis }} + +## SYNTAX + +### FoundSet (Default) +``` +Update-WinGetPackage [-IncludeUnknown] [-Mode ] [-Override ] [-Location ] + [-Force] [-Header ] [-Version ] [-Log ] [-Id ] [-Name ] + [-Moniker ] [-Source ] [[-Query] ] [-Exact] [-WhatIf] [-Confirm] + [] +``` + +### GivenSet +``` +Update-WinGetPackage [-IncludeUnknown] [-Mode ] [-Override ] [-Location ] + [-Force] [-Header ] [[-CatalogPackage] ] [-Version ] [-Log ] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +{{ Fill in the Description }} + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -CatalogPackage +{{ Fill CatalogPackage Description }} + +```yaml +Type: CatalogPackage +Parameter Sets: GivenSet +Aliases: InputObject + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Exact +{{ Fill Exact Description }} + +```yaml +Type: SwitchParameter +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Force +{{ Fill Force Description }} + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Header +{{ Fill Header Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Id +{{ Fill Id Description }} + +```yaml +Type: String +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -IncludeUnknown +{{ Fill IncludeUnknown Description }} + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Location +{{ Fill Location Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Log +{{ Fill Log Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Mode +{{ Fill Mode Description }} + +```yaml +Type: PackageInstallMode +Parameter Sets: (All) +Aliases: +Accepted values: Default, Silent, Interactive + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Moniker +{{ Fill Moniker Description }} + +```yaml +Type: String +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Name +{{ Fill Name Description }} + +```yaml +Type: String +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Override +{{ Fill Override Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Query +{{ Fill Query Description }} + +```yaml +Type: String[] +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Source +{{ Fill Source Description }} + +```yaml +Type: String +Parameter Sets: FoundSet +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -Version +{{ Fill Version Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.Management.Automation.SwitchParameter + +### Microsoft.Management.Deployment.PackageInstallMode + +### System.String + +### Microsoft.Management.Deployment.CatalogPackage + +### System.String[] + +## OUTPUTS + +### Microsoft.Management.Deployment.InstallResult + +## NOTES + +## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/README.md b/src/PowerShell/Microsoft.WinGet.Client/README.md new file mode 100644 index 0000000000..a108c5d2d9 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/README.md @@ -0,0 +1,25 @@ +# Microsoft.WinGet.Client + +This is the source code for the PowerShell module for the Windows Package Manager Client. + +## Building +### Pre-Requisite Steps + +A **PowerShell module** is merely a folder containing a **.psd1** file or a +**.psm1** file. In this scenario, we will be building a folder with a **.psd1** +file and all of the other necessary bits inside. But, before we do that, we need +to make sure of the following steps. + +1. The project has been built for the **x64**, **x86**, **ARM64**, and **ARM** + platforms in **Release** mode. + - The build script also relies on the exact location and structure of the + actual build files. That is, the build script will look for a **bin** + directory in this folder and expects a directory structure like: + - `bin\x64\Release\net6.0-windows10.0.22000.0\` + - `bin\x86\Release\net461\` + +### Running the Script +Once you've done all of the pre-requisite steps, you can build the PowerShell +module folder by running the PowerShell build script. For example, + +- `.\BuildModule.ps1 -In bin -Out build\bin -Configuration Release` diff --git a/src/PowerShell/Microsoft.WinGet.Client/stylecop.json b/src/PowerShell/Microsoft.WinGet.Client/stylecop.json new file mode 100644 index 0000000000..85b0f19bfa --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/stylecop.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", + "settings": { + "documentationRules": { + "companyName": "Microsoft Corporation", + "copyrightText": " Copyright (c) {companyName}. Licensed under the MIT License.", + "headerDecoration": "-----------------------------------------------------------------------------" + } + } +} From ca6d7815674f753b6a59489f39e36948d1d7fba4 Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Thu, 7 Jul 2022 13:01:00 -0700 Subject: [PATCH 02/21] Fixed AppInstallerCLI.sln encoding change. --- src/AppInstallerCLI.sln | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AppInstallerCLI.sln b/src/AppInstallerCLI.sln index 8f084fcebd..dbdbcef65f 100644 --- a/src/AppInstallerCLI.sln +++ b/src/AppInstallerCLI.sln @@ -1,4 +1,4 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29409.12 MinimumVisualStudioVersion = 10.0.40219.1 From ee45b518c5a270062bc61cd2fd01a42180158b36 Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Thu, 7 Jul 2022 14:04:18 -0700 Subject: [PATCH 03/21] Fixed BaseFinderCommand.cs typo. --- .../Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs index 6e7feede24..307864bd88 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs @@ -67,7 +67,7 @@ public class BaseFinderCommand : BaseClientCommand public string[] Query { get; set; } /// - /// Gets or sets a value indicataing whether to match exactly against package fields. + /// Gets or sets a value indicating whether to match exactly against package fields. /// [Parameter( ParameterSetName = Constants.FoundSet, From b36e39565e31f87988f64f4965d3ee7035c285a7 Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Thu, 7 Jul 2022 14:08:13 -0700 Subject: [PATCH 04/21] Changed expect.txt for check-spelling-bot. --- .github/actions/spelling/expect.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 85ac608162..3e3a37fc62 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -1,7 +1,7 @@ abcd accepteula -adjacents activatable +adjacents adml admx affle @@ -162,8 +162,8 @@ hmodule hre hresults htm -IAttachment IARP +IAttachment IConfiguration idx IFACEMETHODIMP @@ -236,8 +236,8 @@ megamorf memcpy middleware midl -minidump minexample +minidump minschema missingdependency MMmmbbbb @@ -277,8 +277,8 @@ NX objbase objidl ofile -Outptr OSVERSION +Outptr Packagedx packageinuse parametermap From 48977f09ff1745d866e7cc016784b14b85438345 Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Thu, 7 Jul 2022 14:12:49 -0700 Subject: [PATCH 05/21] Changed expect.txt for check-spelling-bot again. --- .github/actions/spelling/expect.txt | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 3e3a37fc62..6bdbceb80c 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -1,6 +1,5 @@ abcd accepteula -activatable adjacents adml admx @@ -20,7 +19,6 @@ apicontract apiset appinstallertest appname -Archs arget argumentlist ARMNT @@ -56,6 +54,7 @@ BOMs boundparms brk Buf +buildtransitive BUILTINS cancelledbyuser casemap @@ -81,6 +80,7 @@ COMGLB commandline Concat contactsupport +contentfiles contoso contractversion count'th @@ -103,20 +103,20 @@ diskfull dllimport dnld Dobbeleer -dsc +Dst dustojnikhummer dvinns dw +ebug ecfr ecfrbrowse -efgh endian -enr enums EQU ERANGE errno ESRB +estination etest execustom EXEHASH @@ -139,7 +139,6 @@ FULLMUTEX FULLWIDTH fundraiser fuzzer -FWW fzanollo gcpi GES @@ -147,10 +146,8 @@ GESMBH GHS gitlab gity -Globals Google guiddef -hackathon hashtable helplib helplibrary @@ -214,6 +211,7 @@ learnxinyminutes lhs libsolv libyaml +Lifecycle Linq liv liwpx @@ -226,7 +224,6 @@ LPWSTR LSTATUS LTDA lw -lww lz malware maxvalue @@ -258,7 +255,6 @@ myinstalldir mylog mysilent mysilentwithprogress -mytool NETFX netlify Newtonsoft @@ -277,13 +273,10 @@ NX objbase objidl ofile -OSVERSION Outptr -Packagedx packageinuse -parametermap +paramref pathparts -pathpaths Patil pb PCs @@ -303,6 +296,7 @@ pri processthreads productcode pscustomobject +psd pseudocode psm psobject @@ -361,6 +355,7 @@ standalone startswith streambuf strtoull +stylecop subdir subkey superstring @@ -369,7 +364,6 @@ SUSE swervy SYD SYG -symlink sysrefcomp Tagit TCpp @@ -388,6 +382,7 @@ TResult trimstart TState TStatus +typeof UCase ucasemap UChars @@ -396,7 +391,6 @@ uec uild uintptr ul -Uninitialize uninstallation uninstaller uninstallprevious @@ -425,13 +419,11 @@ vscode vstest vy wcslen -WDAG webpages Webserver website WERSJA wesome -whatif windir windowsdeveloper winerror @@ -441,7 +433,6 @@ winreg withstarts wn Workflows -wsb wsl wsv wto From da7b783dee722bde6c8507896d2a97a5dfcba59c Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Thu, 7 Jul 2022 14:15:49 -0700 Subject: [PATCH 06/21] Changed expect.txt for check-spelling-bot another time. --- .github/actions/spelling/expect.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 6bdbceb80c..e4c71eb367 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -103,6 +103,7 @@ diskfull dllimport dnld Dobbeleer +Dsc Dst dustojnikhummer dvinns @@ -110,6 +111,7 @@ dw ebug ecfr ecfrbrowse +EFGH endian enums EQU @@ -148,6 +150,7 @@ gitlab gity Google guiddef +Hackathon hashtable helplib helplibrary @@ -275,6 +278,7 @@ objidl ofile Outptr packageinuse +PARAMETERMAP paramref pathparts Patil @@ -391,6 +395,7 @@ uec uild uintptr ul +uninitialize uninstallation uninstaller uninstallprevious @@ -424,6 +429,7 @@ Webserver website WERSJA wesome +Whatif windir windowsdeveloper winerror From 45b4404edfdfc9080bc9ed8cc1106d1fc5243a7e Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Tue, 12 Jul 2022 11:46:38 -0700 Subject: [PATCH 07/21] Changed error messages to use localized strings; build script. Integrated WinMD workaround for PowerShell 6 & 7. --- src/AppInstallerCLI.sln | 76 +++++++++- .../Microsoft.WinGet.Client/BuildModule.ps1 | 10 +- .../Commands/BaseClientCommand.cs | 29 +++- .../Commands/BaseFinderCommand.cs | 21 +-- .../Commands/BaseInstallCommand.cs | 4 +- .../Commands/BaseLifecycleCommand.cs | 12 +- .../Commands/InstallPackageCommand.cs | 2 +- .../Commands/UninstallPackageCommand.cs | 2 +- .../Commands/UpdatePackageCommand.cs | 2 +- .../Errors/FindPackagesException.cs | 3 +- .../Errors/VagueCriteriaException.cs | 25 ++-- .../Helpers/Constants.cs | 19 +++ .../Microsoft.WinGet.Client.csproj | 35 ++++- .../Microsoft.WinGet.Client.psd1 | 5 +- .../Microsoft.WinGet.Client/README.md | 2 +- .../Resources/Resources.Designer.cs | 117 +++++++++++++++ .../Resources/Resources.resx | 138 ++++++++++++++++++ 17 files changed, 446 insertions(+), 56 deletions(-) create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.Designer.cs create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.resx diff --git a/src/AppInstallerCLI.sln b/src/AppInstallerCLI.sln index dbdbcef65f..8b6353311f 100644 --- a/src/AppInstallerCLI.sln +++ b/src/AppInstallerCLI.sln @@ -138,7 +138,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Management.Deploy EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PowerShell", "PowerShell", "{7C218A3E-9BC8-48FF-B91B-BCACD828C0C9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.WinGet.Client", "PowerShell\Microsoft.WinGet.Client\Microsoft.WinGet.Client.csproj", "{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.WinGet.Client", "PowerShell\Microsoft.WinGet.Client\Microsoft.WinGet.Client.csproj", "{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UndockedRegFreeWinRT", "UndockedRegFreeWinRT\UndockedRegFreeWinRT\UndockedRegFreeWinRT.vcxproj", "{31ED69A8-5310-45A9-953F-56C351D2C3E1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Detours", "UndockedRegFreeWinRT\detours\detours.vcxproj", "{787EC629-C0FB-4BA9-9746-4A82CD06B73E}" EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution @@ -1070,6 +1074,74 @@ Global {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x64.Build.0 = Debug|x64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x86.ActiveCfg = Debug|x86 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x86.Build.0 = Debug|x86 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Debug|ARM.ActiveCfg = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Debug|ARM64.ActiveCfg = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Debug|x64.ActiveCfg = Debug|x64 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Debug|x64.Build.0 = Debug|x64 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Debug|x86.ActiveCfg = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Debug|x86.Build.0 = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Fuzzing|Any CPU.ActiveCfg = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Fuzzing|Any CPU.Build.0 = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Fuzzing|ARM.ActiveCfg = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Fuzzing|ARM.Build.0 = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Fuzzing|ARM64.ActiveCfg = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Fuzzing|ARM64.Build.0 = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Fuzzing|x64.ActiveCfg = Debug|x64 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Fuzzing|x64.Build.0 = Debug|x64 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Fuzzing|x86.ActiveCfg = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Fuzzing|x86.Build.0 = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|Any CPU.ActiveCfg = Release|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|ARM.ActiveCfg = Release|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|ARM64.ActiveCfg = Release|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|x64.ActiveCfg = Release|x64 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|x64.Build.0 = Release|x64 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|x86.ActiveCfg = Release|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|x86.Build.0 = Release|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|Any CPU.ActiveCfg = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|Any CPU.Build.0 = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|ARM.ActiveCfg = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|ARM.Build.0 = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|ARM64.ActiveCfg = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|ARM64.Build.0 = Debug|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|x64.ActiveCfg = Release|x64 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|x64.Build.0 = Release|x64 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|x86.ActiveCfg = Release|Win32 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|x86.Build.0 = Release|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Debug|ARM.ActiveCfg = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Debug|ARM64.ActiveCfg = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Debug|x64.ActiveCfg = Debug|x64 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Debug|x64.Build.0 = Debug|x64 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Debug|x86.ActiveCfg = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Debug|x86.Build.0 = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Fuzzing|Any CPU.ActiveCfg = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Fuzzing|Any CPU.Build.0 = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Fuzzing|ARM.ActiveCfg = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Fuzzing|ARM.Build.0 = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Fuzzing|ARM64.ActiveCfg = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Fuzzing|ARM64.Build.0 = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Fuzzing|x64.ActiveCfg = Debug|x64 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Fuzzing|x64.Build.0 = Debug|x64 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Fuzzing|x86.ActiveCfg = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Fuzzing|x86.Build.0 = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|Any CPU.ActiveCfg = Release|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|ARM.ActiveCfg = Release|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|ARM64.ActiveCfg = Release|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|x64.ActiveCfg = Release|x64 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|x64.Build.0 = Release|x64 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|x86.ActiveCfg = Release|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|x86.Build.0 = Release|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|Any CPU.ActiveCfg = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|Any CPU.Build.0 = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|ARM.ActiveCfg = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|ARM.Build.0 = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|ARM64.ActiveCfg = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|ARM64.Build.0 = Debug|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|x64.ActiveCfg = Release|x64 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|x64.Build.0 = Release|x64 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|x86.ActiveCfg = Release|Win32 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1090,6 +1162,8 @@ Global {1A47951F-5C7A-4D6D-BB5F-D77484437940} = {8D53D749-D51C-46F8-A162-9371AAA6C2E7} {409CD681-22A4-469D-88AE-CB5E4836E07A} = {8D53D749-D51C-46F8-A162-9371AAA6C2E7} {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C} = {7C218A3E-9BC8-48FF-B91B-BCACD828C0C9} + {31ED69A8-5310-45A9-953F-56C351D2C3E1} = {60618CAC-2995-4DF9-9914-45C6FC02C995} + {787EC629-C0FB-4BA9-9746-4A82CD06B73E} = {60618CAC-2995-4DF9-9914-45C6FC02C995} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B6FDB70C-A751-422C-ACD1-E35419495857} diff --git a/src/PowerShell/Microsoft.WinGet.Client/BuildModule.ps1 b/src/PowerShell/Microsoft.WinGet.Client/BuildModule.ps1 index e2630125e9..0409ab4282 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/BuildModule.ps1 +++ b/src/PowerShell/Microsoft.WinGet.Client/BuildModule.ps1 @@ -14,7 +14,7 @@ param ( $Configuration = 'Release' ) -$CoreFramework = 'net6.0-windows10.0.22000.0' +$CoreFramework = 'net5.0-windows10.0.22000.0' $DesktopFramework = 'net461' if (Test-Path $Out) { @@ -24,10 +24,10 @@ if (Test-Path $Out) { Get-ChildItem $In -ErrorAction SilentlyContinue -Exclude 'Debug','Release' | ForEach-Object { Write-Verbose ($_.FullName) - $coreSrcPath = Join-Path $_.FullName $Configuration $CoreFramework - $coreDstPath = Join-Path $Out $_.Name 'Core' - $desktopSrcPath = Join-Path $_.FullName $Configuration $DesktopFramework - $desktopDstPath = Join-Path $Out $_.Name 'Desktop' + $coreSrcPath = Join-Path (Join-Path $_.FullName $Configuration) $CoreFramework + $coreDstPath = Join-Path (Join-Path $Out $_.Name) 'Core' + $desktopSrcPath = Join-Path (Join-Path $_.FullName $Configuration) $DesktopFramework + $desktopDstPath = Join-Path (Join-Path $Out $_.Name) 'Desktop' Copy-Item $coreSrcPath -Destination $coreDstPath -Recurse -Force Copy-Item $desktopSrcPath -Destination $desktopDstPath -Recurse -Force diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseClientCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseClientCommand.cs index eada00fcf9..f396e99bc6 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseClientCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseClientCommand.cs @@ -9,9 +9,11 @@ namespace Microsoft.WinGet.Client.Commands using System; using System.Collections.Generic; using System.Management.Automation; + using System.Runtime.InteropServices; using System.Security.Principal; using Microsoft.Management.Deployment; using Microsoft.WinGet.Client.Factories; + using Microsoft.WinGet.Client.Helpers; /// /// This is the base class for all commands in this module. @@ -24,12 +26,10 @@ public class BaseClientCommand : PSCmdlet public BaseClientCommand() : base() { - var identity = WindowsIdentity.GetCurrent(); - var principal = new WindowsPrincipal(identity); - var admin = principal.IsInRole(WindowsBuiltInRole.Administrator); + var admin = CheckIfAdministrator(); if (admin) { - throw new Exception(@"This cmdlet is currently not available in an administrator context."); + throw new Exception(Constants.ResourceManager.GetString("ExceptionMessages_NoAdmin")); } } @@ -43,6 +43,8 @@ public BaseClientCommand() /// protected static Lazy PackageManager { get; } = new Lazy(() => ComObjectFactory.Value.CreatePackageManager()); + private static bool InitializedUndockedRegFreeWinRT { get; set; } = InitializeUndockedRegFreeWinRT(); + /// /// Retrieves the specified source or all sources if is null. /// @@ -60,10 +62,27 @@ protected static IReadOnlyList GetPackageCatalogReferen return new List() { PackageManager.Value.GetPackageCatalogByName(source) - ?? throw new ArgumentException("No sources match the given value: " + source), + ?? throw new ArgumentException(Constants.ResourceManager.GetString("ExceptionMessages_SourceNotFound")), }; } } + [DllImport("winrtact.dll", PreserveSig = false)] +#pragma warning disable SA1300 // Element should begin with upper-case letter + private static extern void winrtact_Initialize(); +#pragma warning restore SA1300 // Element should begin with upper-case letter + + private static bool InitializeUndockedRegFreeWinRT() + { + winrtact_Initialize(); + return true; + } + + private static bool CheckIfAdministrator() + { + WindowsIdentity identity = WindowsIdentity.GetCurrent(); + var principal = new WindowsPrincipal(identity); + return principal.IsInRole(WindowsBuiltInRole.Administrator); + } } } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs index 307864bd88..ac94ec0630 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs @@ -84,14 +84,15 @@ private string QueryAsJoinedString } } - private PackageFieldMatchOption ExactAsMatchOption + /// + /// Returns a based on a parameter. + /// + /// A value. + protected virtual PackageFieldMatchOption GetExactAsMatchOption() { - get - { - return this.Exact.ToBool() - ? PackageFieldMatchOption.EqualsCaseInsensitive - : PackageFieldMatchOption.ContainsCaseInsensitive; - } + return this.Exact.ToBool() + ? PackageFieldMatchOption.EqualsCaseInsensitive + : PackageFieldMatchOption.ContainsCaseInsensitive; } /// @@ -156,7 +157,7 @@ private PackageCatalog GetPackageCatalog(CompositeSearchBehavior behavior) var result = reference.Connect(); if (result.Status != ConnectResultStatus.Ok) { - throw new RuntimeException("There was an error connecting to the source."); + throw new RuntimeException(Constants.ResourceManager.GetString("ExceptionMessages_CatalogError")); } return result.PackageCatalog; @@ -178,8 +179,8 @@ private PackageCatalogReference GetPackageCatalogReference(CompositeSearchBehavi private FindPackagesOptions GetFindPackagesOptions(uint limit) { var options = ComObjectFactory.Value.CreateFindPackagesOptions(); - SetQueryInFindPackagesOptions(ref options, this.ExactAsMatchOption, this.QueryAsJoinedString); - this.AddAttributedFiltersToFindPackagesOptions(ref options, this.ExactAsMatchOption); + SetQueryInFindPackagesOptions(ref options, this.GetExactAsMatchOption(), this.QueryAsJoinedString); + this.AddAttributedFiltersToFindPackagesOptions(ref options, this.GetExactAsMatchOption()); options.ResultLimit = limit; return options; } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseInstallCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseInstallCommand.cs index 973a7784c6..dc2257fff4 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseInstallCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseInstallCommand.cs @@ -45,7 +45,7 @@ public string Location string prefix = Path.IsPathRooted(value) ? string.Empty : this.SessionState.Path.CurrentFileSystemLocation + @"\"; - + this.location = prefix + value; } } @@ -121,7 +121,7 @@ protected InstallResult RegisterCallbacksAndWait( RecordType = ProgressRecordType.Processing, }; - if (progress.State == PackageInstallProgressState.Downloading) + if ((progress.State == PackageInstallProgressState.Downloading) && (progress.BytesRequired != 0)) { record.StatusDescription = $"{progress.BytesDownloaded / 1000000.0f:0.0} MB / {progress.BytesRequired / 1000000.0f:0.0} MB"; record.PercentComplete = (int)(progress.DownloadProgress * 100); diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseLifecycleCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseLifecycleCommand.cs index f2cb6f4cdc..d5d4f3c340 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseLifecycleCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseLifecycleCommand.cs @@ -9,7 +9,10 @@ namespace Microsoft.WinGet.Client.Commands using System; using System.IO; using System.Management.Automation; + using System.Reflection; + using System.Resources; using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Errors; using Microsoft.WinGet.Client.Helpers; /// @@ -49,7 +52,7 @@ public string Log string prefix = Path.IsPathRooted(value) ? string.Empty : this.SessionState.Path.CurrentFileSystemLocation + @"\"; - + this.log = prefix + value; } } @@ -59,7 +62,7 @@ public string Log /// /// The value. /// The method to call after retrieving the package and version to operate upon. - protected void ExecuteCommand( + protected void GetPackageAndExecute( CompositeSearchBehavior behavior, Action callback) { @@ -87,13 +90,12 @@ private CatalogPackage GetCatalogPackage(CompositeSearchBehavior behavior) } else if (results.Count == 0) { - throw new RuntimeException(@"No package found matching input criteria."); + throw new RuntimeException(Constants.ResourceManager.GetString("ExceptionMessages_NoPackagesFound")); } else { - throw new Errors.VagueCriteriaException(results[0].CatalogPackage, results[1].CatalogPackage); + throw new VagueCriteriaException(results); } - } } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs index 40f751378d..57142e8f51 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs @@ -64,7 +64,7 @@ protected override void BeginProcessing() protected override void ProcessRecord() { base.ProcessRecord(); - this.ExecuteCommand(CompositeSearchBehavior.RemotePackagesFromRemoteCatalogs, (package, version) => + this.GetPackageAndExecute(CompositeSearchBehavior.RemotePackagesFromRemoteCatalogs, (package, version) => { var options = this.GetInstallOptions(version); var results = this.InstallPackage(package, options); diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs index 626db745b1..ad1c2bb937 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs @@ -33,7 +33,7 @@ public sealed class UninstallPackageCommand : BaseLifecycleCommand /// protected override void ProcessRecord() { - this.ExecuteCommand(CompositeSearchBehavior.LocalCatalogs, (package, version) => + this.GetPackageAndExecute(CompositeSearchBehavior.LocalCatalogs, (package, version) => { var options = this.GetUninstallOptions(version); var results = this.UninstallPackage(package, options); diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs index 25aec9c9e8..165341cf1b 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs @@ -34,7 +34,7 @@ public sealed class UpdatePackageCommand : BaseInstallCommand protected override void ProcessRecord() { base.ProcessRecord(); - this.ExecuteCommand(CompositeSearchBehavior.LocalCatalogs, (package, version) => + this.GetPackageAndExecute(CompositeSearchBehavior.LocalCatalogs, (package, version) => { var options = this.GetInstallOptions(version); var results = this.UpgradePackage(package, options); diff --git a/src/PowerShell/Microsoft.WinGet.Client/Errors/FindPackagesException.cs b/src/PowerShell/Microsoft.WinGet.Client/Errors/FindPackagesException.cs index 1b95514dc7..bdcd2e392f 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Errors/FindPackagesException.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Errors/FindPackagesException.cs @@ -8,6 +8,7 @@ namespace Microsoft.WinGet.Client.Errors { using System; using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Helpers; /// /// Raised when there is an error searching for packages. @@ -20,7 +21,7 @@ public class FindPackagesException : Exception /// /// A value. public FindPackagesException(FindPackagesResultStatus status) - : base(@"There was an error searching for packages.") + : base(Constants.ResourceManager.GetString("ExceptionMessages_SearchFailure")) { this.Status = status; } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Errors/VagueCriteriaException.cs b/src/PowerShell/Microsoft.WinGet.Client/Errors/VagueCriteriaException.cs index 4320222f2c..1576573c49 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Errors/VagueCriteriaException.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Errors/VagueCriteriaException.cs @@ -7,7 +7,9 @@ namespace Microsoft.WinGet.Client.Errors { using System; + using System.Collections.Generic; using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Helpers; /// /// Raised when search criteria for installing or updating a package is too vague. @@ -18,23 +20,20 @@ public class VagueCriteriaException : Exception /// /// Initializes a new instance of the class. /// - /// The first instance. - /// The second instance. - public VagueCriteriaException(CatalogPackage one, CatalogPackage two) - : base($"Both '{one.ToString(null)}' and '{two.ToString(null)}' match the input criteria. Please refine the input.") + /// The list of conflicting packages of length at least two. + public VagueCriteriaException(IReadOnlyList results) + : base(string.Format( + Constants.ResourceManager.GetString("ExceptionMessages_VagueSearch"), + (results.Count > 0) ? results[0].CatalogPackage.ToString(null) : null, + (results.Count > 1) ? results[1].CatalogPackage.ToString(null) : null, + Math.Max(results.Count, 2) - 2)) { - this.PackageOne = one; - this.PackageTwo = two; + this.MatchResults = results; } /// - /// Gets or sets the first conflicting package. + /// Gets or sets the list of conflicting packages. /// - public CatalogPackage PackageOne { get; set; } - - /// - /// Gets or sets the second conflicting package. - /// - public CatalogPackage PackageTwo { get; set; } + public IReadOnlyList MatchResults { get; set; } } } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Helpers/Constants.cs b/src/PowerShell/Microsoft.WinGet.Client/Helpers/Constants.cs index e3e73cf6e1..727e09a290 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Helpers/Constants.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Helpers/Constants.cs @@ -6,6 +6,8 @@ namespace Microsoft.WinGet.Client.Helpers { + using System.Reflection; + using System.Resources; using Microsoft.Management.Deployment; /// @@ -42,5 +44,22 @@ public static class Constants /// This is the name of the parameter set for when a package was not supplied. /// public const string FoundSet = "FoundSet"; + + /// + /// This is the path provided to the resource manager to access localized strings. + /// + public const string ResourcesPath = "Microsoft.WinGet.Client.Resources.Resources"; + + /// + /// Gets the instance for the executing assembly. + /// + public static ResourceManager ResourceManager + { + get + { + Assembly assembly = Assembly.GetExecutingAssembly(); + return new ResourceManager(ResourcesPath, assembly); + } + } } } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj index b7ba692485..b7b8d0ed53 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj @@ -1,8 +1,8 @@  - net6.0-windows10.0.22000.0;net461 - ARM;ARM64;x64;x86 + net5.0-windows10.0.22000.0;net461 + ARM64;x64;x86 true @@ -16,21 +16,44 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + - + + Content + Always + + + Content + Always + - + - + - + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + Microsoft.Management.Deployment 10.0.22000.0 diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 index 0d20f7aef8..9069753a7b 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 @@ -72,11 +72,8 @@ elseif ($env:PROCESSOR_ARCHITECTURE -like 'x86') { "x86\$PSEdition\Microsoft.WinGet.Client.dll" } - elseif ($env:PROCESSOR_ARCHITECTURE -like 'arm64') { - "ARM64\$PSEdition\Microsoft.WinGet.Client.dll" - } else { - "ARM\$PSEdition\Microsoft.WinGet.Client.dll" + "ARM64\$PSEdition\Microsoft.WinGet.Client.dll" } # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. diff --git a/src/PowerShell/Microsoft.WinGet.Client/README.md b/src/PowerShell/Microsoft.WinGet.Client/README.md index a108c5d2d9..6d950f07fd 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/README.md +++ b/src/PowerShell/Microsoft.WinGet.Client/README.md @@ -10,7 +10,7 @@ A **PowerShell module** is merely a folder containing a **.psd1** file or a file and all of the other necessary bits inside. But, before we do that, we need to make sure of the following steps. -1. The project has been built for the **x64**, **x86**, **ARM64**, and **ARM** +1. The project has been built for the **x64**, **x86**, and **ARM64** platforms in **Release** mode. - The build script also relies on the exact location and structure of the actual build files. That is, the build script will look for a **bin** diff --git a/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.Designer.cs b/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.Designer.cs new file mode 100644 index 0000000000..b0b9eed49b --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.Designer.cs @@ -0,0 +1,117 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.WinGet.Client.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.WinGet.Client.Resources.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to There was an error connecting to the source.. + /// + internal static string ExceptionMessages_CatalogError { + get { + return ResourceManager.GetString("ExceptionMessages_CatalogError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This cmdlet is currently not available in an administrator context.. + /// + internal static string ExceptionMessages_NoAdmin { + get { + return ResourceManager.GetString("ExceptionMessages_NoAdmin", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No packages matched the given input criteria.. + /// + internal static string ExceptionMessages_NoPackagesFound { + get { + return ResourceManager.GetString("ExceptionMessages_NoPackagesFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There was an error searching for packages.. + /// + internal static string ExceptionMessages_SearchFailure { + get { + return ResourceManager.GetString("ExceptionMessages_SearchFailure", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A source with the given name was not found.. + /// + internal static string ExceptionMessages_SourceNotFound { + get { + return ResourceManager.GetString("ExceptionMessages_SourceNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to '{0}', '{1}', and {2} other package(s) matched the input criteria. Please refine the input.. + /// + internal static string ExceptionMessages_VagueSearch { + get { + return ResourceManager.GetString("ExceptionMessages_VagueSearch", resourceCulture); + } + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.resx b/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.resx new file mode 100644 index 0000000000..dfa3e748d2 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + There was an error connecting to the source. + + + This cmdlet is currently not available in an administrator context. + + + No packages matched the given input criteria. + + + There was an error searching for packages. + + + A source with the given name was not found. + + + '{0}', '{1}', and {2} other package(s) matched the input criteria. Please refine the input. + + \ No newline at end of file From 08bc0af00821e07ff101fb3842a3bcca6fc4ed6f Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Tue, 12 Jul 2022 12:27:25 -0700 Subject: [PATCH 08/21] Changed version logic; exact behavior; and attached all results to vague criteria error. --- .../Commands/BaseFinderCommand.cs | 2 +- .../Commands/BaseLifecycleCommand.cs | 21 ++++++++++--------- .../Commands/InstallPackageCommand.cs | 1 - .../Commands/UpdatePackageCommand.cs | 1 - .../Resources/Resources.Designer.cs | 9 ++++++++ .../Resources/Resources.resx | 3 +++ 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs index ac94ec0630..39bcc3cc15 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs @@ -91,7 +91,7 @@ private string QueryAsJoinedString protected virtual PackageFieldMatchOption GetExactAsMatchOption() { return this.Exact.ToBool() - ? PackageFieldMatchOption.EqualsCaseInsensitive + ? PackageFieldMatchOption.Equals : PackageFieldMatchOption.ContainsCaseInsensitive; } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseLifecycleCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseLifecycleCommand.cs index d5d4f3c340..eef24d24ea 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseLifecycleCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseLifecycleCommand.cs @@ -9,8 +9,6 @@ namespace Microsoft.WinGet.Client.Commands using System; using System.IO; using System.Management.Automation; - using System.Reflection; - using System.Resources; using Microsoft.Management.Deployment; using Microsoft.WinGet.Client.Errors; using Microsoft.WinGet.Client.Helpers; @@ -57,6 +55,14 @@ public string Log } } + /// + protected override PackageFieldMatchOption GetExactAsMatchOption() + { + return this.Exact.ToBool() + ? PackageFieldMatchOption.Equals + : PackageFieldMatchOption.EqualsCaseInsensitive; + } + /// /// Executes a command targeting a specific package version. /// @@ -83,7 +89,7 @@ private CatalogPackage GetCatalogPackage(CompositeSearchBehavior behavior) } else { - var results = this.FindPackages(behavior, 2); + var results = this.FindPackages(behavior, 0); if (results.Count == 1) { return results[0].CatalogPackage; @@ -107,18 +113,13 @@ private PackageVersionId GetPackageVersionId(CatalogPackage package) for (var i = 0; i < versions.Count; i++) { - // PackageVersionInfo.DisplayName (?) - bool match = this.Version.Equals( - versions[i].Version, - StringComparison.OrdinalIgnoreCase); - - if (match) + if (versions[i].Version.CompareTo(this.Version) == 0) { return versions[i]; } } - throw new ArgumentException("No version found matching: " + this.Version); + throw new ArgumentException(Constants.ResourceManager.GetString("ExceptionMessages_VersionNotFound")); } else { diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs index 57142e8f51..6aa731ab62 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs @@ -10,7 +10,6 @@ namespace Microsoft.WinGet.Client.Commands { - using System; using System.Management.Automation; using Microsoft.Management.Deployment; using Microsoft.WinGet.Client.Helpers; diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs index 165341cf1b..c6b195231c 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs @@ -6,7 +6,6 @@ namespace Microsoft.WinGet.Client.Commands { - using System; using System.Management.Automation; using Microsoft.Management.Deployment; using Microsoft.WinGet.Client.Helpers; diff --git a/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.Designer.cs b/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.Designer.cs index b0b9eed49b..4660212397 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.Designer.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.Designer.cs @@ -113,5 +113,14 @@ internal static string ExceptionMessages_VagueSearch { return ResourceManager.GetString("ExceptionMessages_VagueSearch", resourceCulture); } } + + /// + /// Looks up a localized string similar to No version matched the given input criteria.. + /// + internal static string ExceptionMessages_VersionNotFound { + get { + return ResourceManager.GetString("ExceptionMessages_VersionNotFound", resourceCulture); + } + } } } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.resx b/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.resx index dfa3e748d2..bb24c59bd8 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.resx +++ b/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.resx @@ -135,4 +135,7 @@ '{0}', '{1}', and {2} other package(s) matched the input criteria. Please refine the input. + + No version matched the given input criteria. + \ No newline at end of file From 4d650ba9becab5e7fb917eea95ef12e97e3abd11 Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Thu, 14 Jul 2022 09:06:07 -0700 Subject: [PATCH 09/21] Fixed configuration mapping --- src/AppInstallerCLI.sln | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/AppInstallerCLI.sln b/src/AppInstallerCLI.sln index 8b6353311f..d683b1ce84 100644 --- a/src/AppInstallerCLI.sln +++ b/src/AppInstallerCLI.sln @@ -1034,40 +1034,32 @@ Global {9AC3C6A4-1875-4D3E-BF9C-C31E81EFF6B4}.TestRelease|x64.Build.0 = Release|x64 {9AC3C6A4-1875-4D3E-BF9C-C31E81EFF6B4}.TestRelease|x86.ActiveCfg = Release|Win32 {9AC3C6A4-1875-4D3E-BF9C-C31E81EFF6B4}.TestRelease|x86.Build.0 = Release|Win32 - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|Any CPU.ActiveCfg = Debug|ARM - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|Any CPU.Build.0 = Debug|ARM - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|ARM.ActiveCfg = Debug|ARM - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|ARM.Build.0 = Debug|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|Any CPU.ActiveCfg = Debug|ARM64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|ARM.ActiveCfg = Debug|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|ARM64.ActiveCfg = Debug|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|ARM64.Build.0 = Debug|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|x64.ActiveCfg = Debug|x64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|x64.Build.0 = Debug|x64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|x86.ActiveCfg = Debug|x86 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Debug|x86.Build.0 = Debug|x86 - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|Any CPU.ActiveCfg = Debug|ARM - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|Any CPU.Build.0 = Debug|ARM - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|ARM.ActiveCfg = Debug|ARM - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|ARM.Build.0 = Debug|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|Any CPU.ActiveCfg = Debug|ARM64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|ARM.ActiveCfg = Debug|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|ARM64.ActiveCfg = Debug|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|ARM64.Build.0 = Debug|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x64.ActiveCfg = Debug|x64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x64.Build.0 = Debug|x64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x86.ActiveCfg = Debug|x86 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x86.Build.0 = Debug|x86 - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|Any CPU.ActiveCfg = Release|ARM - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|Any CPU.Build.0 = Release|ARM - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|ARM.ActiveCfg = Release|ARM - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|ARM.Build.0 = Release|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|Any CPU.ActiveCfg = Release|ARM64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|ARM.ActiveCfg = Release|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|ARM64.ActiveCfg = Release|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|ARM64.Build.0 = Release|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|x64.ActiveCfg = Release|x64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|x64.Build.0 = Release|x64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|x86.ActiveCfg = Release|x86 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|x86.Build.0 = Release|x86 - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|Any CPU.ActiveCfg = Debug|ARM - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|Any CPU.Build.0 = Debug|ARM - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM.ActiveCfg = Debug|ARM - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM.Build.0 = Debug|ARM + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|Any CPU.ActiveCfg = Debug|ARM64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM.ActiveCfg = Debug|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM64.ActiveCfg = Debug|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM64.Build.0 = Debug|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x64.ActiveCfg = Debug|x64 From 61b5c79c800843ee115bcb66b01796ee35a13dc2 Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Thu, 14 Jul 2022 09:08:44 -0700 Subject: [PATCH 10/21] Spelling --- .github/actions/spelling/expect.txt | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 418e1f1b63..395884933e 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -53,6 +53,7 @@ bomgar BOMs boundparms brk +Browsable Buf buildtransitive BUILTINS @@ -70,7 +71,6 @@ cfr cgi cgmanifest chcp -ci cinq CLIE cloudapp @@ -107,7 +107,6 @@ Dsc Dst dustojnikhummer dvinns -dw ebug ecfr ecfrbrowse @@ -124,7 +123,6 @@ execustom EXEHASH experimentalfeatures fcb -fd fdw fedorapeople fileinuse @@ -201,14 +199,12 @@ IZone jdk jfearn JObject -jp jpalardy JREs jrsoftware jsoncpp kayone Keivan -KF KNOWNFOLDERID ktf langs @@ -227,12 +223,10 @@ localhost localizationpriority LPBYTE LPDWORD -LPITEMIDLIST +lpitemidlist LPWSTR LSTATUS LTDA -lw -lz malware maxvalue MBH @@ -257,13 +251,11 @@ MSIXHASH msstore Multideclaration multimap -mx mycustom myinstalldir mylog mysilent mysilentwithprogress -mytool NESTEDINSTALLER NETFX netlify @@ -280,7 +272,6 @@ npp nsis nuffing nullopt -NX objbase objidl ofile @@ -290,7 +281,6 @@ PARAMETERMAP paramref pathparts Patil -pb PCs pcwsz pdp @@ -299,7 +289,7 @@ pfn pfxpath Pherson pidl -PIDLIST +pidlist pkgmgr pkindex PMS @@ -319,9 +309,6 @@ pvm pwabuilder PWAs PWSTR -px -pz -qb qword rbegin readonly @@ -407,7 +394,6 @@ ucnv uec uild uintptr -ul uninitialize uninstallation uninstaller @@ -435,7 +421,6 @@ virtualization vns vscode vstest -vy wcslen webpages Webserver @@ -449,14 +434,15 @@ winerror wingetcreate wingetdev winreg +winrtact withstarts -wn Workflows wsl wsv wto wwinmain WZDNCRFJ +XFile XPLATSTR xsi yamlcreateps @@ -464,4 +450,3 @@ yao ype Zanollo ZIPHASH -zy From 13dba24a59dde1180a4c0548af172b8a9fd1f141 Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Tue, 19 Jul 2022 00:51:16 -0700 Subject: [PATCH 11/21] Remove PlatyPS until ready; slight tweaks. Replace command with Enable or Disable-WinGetSetting --- .../{BuildModule.ps1 => Build-Module.ps1} | 0 .../Microsoft.WinGet.Client/Crescendo.json | 32 +- .../Helpers/Constants.cs | 2 +- .../Microsoft.WinGet.Client.psd1 | 4 +- .../Microsoft.WinGet.Client.psm1 | 1184 +++++++++-------- .../PlatyPS/en-US/Add-WinGetSource.md | 90 -- .../en-US/Disable-WinGetLocalManifest.md | 45 - .../en-US/Enable-WinGetLocalManifest.md | 45 - .../PlatyPS/en-US/Find-WinGetPackage.md | 188 --- .../PlatyPS/en-US/Get-WinGetPackage.md | 188 --- .../PlatyPS/en-US/Get-WinGetSource.md | 61 - .../PlatyPS/en-US/Get-WinGetVersion.md | 45 - .../PlatyPS/en-US/Install-WinGetPackage.md | 344 ----- .../PlatyPS/en-US/Remove-WinGetSource.md | 60 - .../PlatyPS/en-US/Reset-WinGetSource.md | 60 - .../PlatyPS/en-US/Uninstall-WinGetPackage.md | 245 ---- .../PlatyPS/en-US/Update-WinGetPackage.md | 322 ----- .../Resources.Designer.cs | 252 ++-- .../{Resources => Properties}/Resources.resx | 0 .../Microsoft.WinGet.Client/README.md | 2 +- 20 files changed, 765 insertions(+), 2404 deletions(-) rename src/PowerShell/Microsoft.WinGet.Client/{BuildModule.ps1 => Build-Module.ps1} (100%) delete mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Add-WinGetSource.md delete mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Disable-WinGetLocalManifest.md delete mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Enable-WinGetLocalManifest.md delete mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Find-WinGetPackage.md delete mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetPackage.md delete mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetSource.md delete mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetVersion.md delete mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Install-WinGetPackage.md delete mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Remove-WinGetSource.md delete mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Reset-WinGetSource.md delete mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Uninstall-WinGetPackage.md delete mode 100644 src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Update-WinGetPackage.md rename src/PowerShell/Microsoft.WinGet.Client/{Resources => Properties}/Resources.Designer.cs (95%) rename src/PowerShell/Microsoft.WinGet.Client/{Resources => Properties}/Resources.resx (100%) diff --git a/src/PowerShell/Microsoft.WinGet.Client/BuildModule.ps1 b/src/PowerShell/Microsoft.WinGet.Client/Build-Module.ps1 similarity index 100% rename from src/PowerShell/Microsoft.WinGet.Client/BuildModule.ps1 rename to src/PowerShell/Microsoft.WinGet.Client/Build-Module.ps1 diff --git a/src/PowerShell/Microsoft.WinGet.Client/Crescendo.json b/src/PowerShell/Microsoft.WinGet.Client/Crescendo.json index 5fecbb1fc0..1ff08022ab 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Crescendo.json +++ b/src/PowerShell/Microsoft.WinGet.Client/Crescendo.json @@ -14,28 +14,48 @@ }, { "Verb": "Enable", - "Noun": "WinGetLocalManifest", + "Noun": "WinGetSetting", "Platform": [ "Windows" ], "OriginalName": "winget.exe", "OriginalCommandElements": [ "settings", - "--enable", - "LocalManifestFiles" + "--enable" + ], + "Parameters": [ + { + "Mandatory": true, + "Name": "Name", + "OriginalPosition": 0, + "Position": 0, + "ValueFromPipeline": true, + "ValueFromPipelineByPropertyName": true, + "ParameterType": "string" + } ] }, { "Verb": "Disable", - "Noun": "WinGetLocalManifest", + "Noun": "WinGetSetting", "Platform": [ "Windows" ], "OriginalName": "winget.exe", "OriginalCommandElements": [ "settings", - "--disable", - "LocalManifestFiles" + "--disable" + ], + "Parameters": [ + { + "Mandatory": true, + "Name": "Name", + "OriginalPosition": 0, + "Position": 0, + "ValueFromPipeline": true, + "ValueFromPipelineByPropertyName": true, + "ParameterType": "string" + } ] }, { diff --git a/src/PowerShell/Microsoft.WinGet.Client/Helpers/Constants.cs b/src/PowerShell/Microsoft.WinGet.Client/Helpers/Constants.cs index 727e09a290..bb98e7452b 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Helpers/Constants.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Helpers/Constants.cs @@ -48,7 +48,7 @@ public static class Constants /// /// This is the path provided to the resource manager to access localized strings. /// - public const string ResourcesPath = "Microsoft.WinGet.Client.Resources.Resources"; + public const string ResourcesPath = "Microsoft.WinGet.Client.Properties.Resources"; /// /// Gets the instance for the executing assembly. diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 index 9069753a7b..b4151817eb 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 @@ -80,8 +80,8 @@ FunctionsToExport = @( 'Get-WinGetVersion' 'Get-WinGetVersion', - 'Enable-WinGetLocalManifest', - 'Disable-WinGetLocalManifest', + 'Enable-WinGetSetting', + 'Disable-WinGetSetting', 'Add-WinGetSource', 'Remove-WinGetSource', 'Reset-WinGetSource' diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psm1 b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psm1 index 1583e87fa6..c898a455a8 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psm1 +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psm1 @@ -1,86 +1,86 @@ -# Module created by Microsoft.PowerShell.Crescendo -class PowerShellCustomFunctionAttribute : System.Attribute { - [bool]$RequiresElevation - [string]$Source - PowerShellCustomFunctionAttribute() { $this.RequiresElevation = $false; $this.Source = "Microsoft.PowerShell.Crescendo" } - PowerShellCustomFunctionAttribute([bool]$rElevation) { - $this.RequiresElevation = $rElevation - $this.Source = "Microsoft.PowerShell.Crescendo" - } -} - - - +# Module created by Microsoft.PowerShell.Crescendo +class PowerShellCustomFunctionAttribute : System.Attribute { + [bool]$RequiresElevation + [string]$Source + PowerShellCustomFunctionAttribute() { $this.RequiresElevation = $false; $this.Source = "Microsoft.PowerShell.Crescendo" } + PowerShellCustomFunctionAttribute([bool]$rElevation) { + $this.RequiresElevation = $rElevation + $this.Source = "Microsoft.PowerShell.Crescendo" + } +} + + + function Get-WinGetVersion -{ -[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] -[CmdletBinding()] - -param( ) - -BEGIN { - $__PARAMETERMAP = @{} - $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } -} - -PROCESS { - $__boundParameters = $PSBoundParameters - $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name - $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) - $__commandArgs = @() - $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) - if ($__boundParameters["Debug"]){wait-debugger} - $__commandArgs += '--version' - foreach ($paramName in $__boundParameters.Keys| - Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| - Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { - $value = $__boundParameters[$paramName] - $param = $__PARAMETERMAP[$paramName] - if ($param) { - if ($value -is [switch]) { - if ($value.IsPresent) { - if ($param.OriginalName) { $__commandArgs += $param.OriginalName } - } - elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } - } - elseif ( $param.NoGap ) { - $pFmt = "{0}{1}" - if($value -match "\s") { $pFmt = "{0}""{1}""" } - $__commandArgs += $pFmt -f $param.OriginalName, $value - } - else { - if($param.OriginalName) { $__commandArgs += $param.OriginalName } - $__commandArgs += $value | Foreach-Object {$_} - } - } - } - $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} - if ($__boundParameters["Debug"]){wait-debugger} - if ( $__boundParameters["Verbose"]) { - Write-Verbose -Verbose -Message winget.exe - $__commandArgs | Write-Verbose -Verbose - } - $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] - if (! $__handlerInfo ) { - $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present - } - $__handler = $__handlerInfo.Handler - if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { - # check for the application and throw if it cannot be found - if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { - throw "Cannot find executable 'winget.exe'" - } - if ( $__handlerInfo.StreamOutput ) { - & "winget.exe" $__commandArgs | & $__handler - } - else { - $result = & "winget.exe" $__commandArgs - & $__handler $result - } - } - } # end PROCESS - -<# +{ +[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] +[CmdletBinding()] + +param( ) + +BEGIN { + $__PARAMETERMAP = @{} + $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } +} + +PROCESS { + $__boundParameters = $PSBoundParameters + $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name + $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) + $__commandArgs = @() + $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) + if ($__boundParameters["Debug"]){wait-debugger} + $__commandArgs += '--version' + foreach ($paramName in $__boundParameters.Keys| + Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| + Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { + $value = $__boundParameters[$paramName] + $param = $__PARAMETERMAP[$paramName] + if ($param) { + if ($value -is [switch]) { + if ($value.IsPresent) { + if ($param.OriginalName) { $__commandArgs += $param.OriginalName } + } + elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } + } + elseif ( $param.NoGap ) { + $pFmt = "{0}{1}" + if($value -match "\s") { $pFmt = "{0}""{1}""" } + $__commandArgs += $pFmt -f $param.OriginalName, $value + } + else { + if($param.OriginalName) { $__commandArgs += $param.OriginalName } + $__commandArgs += $value | Foreach-Object {$_} + } + } + } + $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} + if ($__boundParameters["Debug"]){wait-debugger} + if ( $__boundParameters["Verbose"]) { + Write-Verbose -Verbose -Message winget.exe + $__commandArgs | Write-Verbose -Verbose + } + $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] + if (! $__handlerInfo ) { + $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present + } + $__handler = $__handlerInfo.Handler + if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { + # check for the application and throw if it cannot be found + if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { + throw "Cannot find executable 'winget.exe'" + } + if ( $__handlerInfo.StreamOutput ) { + & "winget.exe" $__commandArgs | & $__handler + } + else { + $result = & "winget.exe" $__commandArgs + & $__handler $result + } + } + } # end PROCESS + +<# .SYNOPSIS Windows Package Manager (Preview) v1.3.1391-preview Copyright (c) Microsoft Corporation. All rights reserved. @@ -110,88 +110,100 @@ The following options are available: -v,--version Display the version of the tool --info Display general info of the tool -More help can be found at: https://aka.ms/winget-command-help - -.DESCRIPTION See help for winget.exe - -#> -} - - - - -function Enable-WinGetLocalManifest -{ -[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] -[CmdletBinding()] - -param( ) - -BEGIN { - $__PARAMETERMAP = @{} - $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } -} - -PROCESS { - $__boundParameters = $PSBoundParameters - $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name - $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) - $__commandArgs = @() - $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) - if ($__boundParameters["Debug"]){wait-debugger} - $__commandArgs += 'settings' - $__commandArgs += '--enable' - $__commandArgs += 'LocalManifestFiles' - foreach ($paramName in $__boundParameters.Keys| - Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| - Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { - $value = $__boundParameters[$paramName] - $param = $__PARAMETERMAP[$paramName] - if ($param) { - if ($value -is [switch]) { - if ($value.IsPresent) { - if ($param.OriginalName) { $__commandArgs += $param.OriginalName } - } - elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } - } - elseif ( $param.NoGap ) { - $pFmt = "{0}{1}" - if($value -match "\s") { $pFmt = "{0}""{1}""" } - $__commandArgs += $pFmt -f $param.OriginalName, $value - } - else { - if($param.OriginalName) { $__commandArgs += $param.OriginalName } - $__commandArgs += $value | Foreach-Object {$_} - } - } - } - $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} - if ($__boundParameters["Debug"]){wait-debugger} - if ( $__boundParameters["Verbose"]) { - Write-Verbose -Verbose -Message winget.exe - $__commandArgs | Write-Verbose -Verbose - } - $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] - if (! $__handlerInfo ) { - $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present - } - $__handler = $__handlerInfo.Handler - if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { - # check for the application and throw if it cannot be found - if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { - throw "Cannot find executable 'winget.exe'" - } - if ( $__handlerInfo.StreamOutput ) { - & "winget.exe" $__commandArgs | & $__handler - } - else { - $result = & "winget.exe" $__commandArgs - & $__handler $result - } - } - } # end PROCESS - -<# +More help can be found at: https://aka.ms/winget-command-help + +.DESCRIPTION See help for winget.exe + +#> +} + + + + +function Enable-WinGetSetting +{ +[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] +[CmdletBinding()] + +param( +[Parameter(Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Mandatory=$true)] +[string]$Name + ) + +BEGIN { + $__PARAMETERMAP = @{ + Name = @{ + OriginalName = '' + OriginalPosition = '0' + Position = '0' + ParameterType = 'string' + ApplyToExecutable = $False + NoGap = $False + } + } + + $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } +} + +PROCESS { + $__boundParameters = $PSBoundParameters + $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name + $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) + $__commandArgs = @() + $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) + if ($__boundParameters["Debug"]){wait-debugger} + $__commandArgs += 'settings' + $__commandArgs += '--enable' + foreach ($paramName in $__boundParameters.Keys| + Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| + Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { + $value = $__boundParameters[$paramName] + $param = $__PARAMETERMAP[$paramName] + if ($param) { + if ($value -is [switch]) { + if ($value.IsPresent) { + if ($param.OriginalName) { $__commandArgs += $param.OriginalName } + } + elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } + } + elseif ( $param.NoGap ) { + $pFmt = "{0}{1}" + if($value -match "\s") { $pFmt = "{0}""{1}""" } + $__commandArgs += $pFmt -f $param.OriginalName, $value + } + else { + if($param.OriginalName) { $__commandArgs += $param.OriginalName } + $__commandArgs += $value | Foreach-Object {$_} + } + } + } + $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} + if ($__boundParameters["Debug"]){wait-debugger} + if ( $__boundParameters["Verbose"]) { + Write-Verbose -Verbose -Message winget.exe + $__commandArgs | Write-Verbose -Verbose + } + $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] + if (! $__handlerInfo ) { + $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present + } + $__handler = $__handlerInfo.Handler + if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { + # check for the application and throw if it cannot be found + if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { + throw "Cannot find executable 'winget.exe'" + } + if ( $__handlerInfo.StreamOutput ) { + & "winget.exe" $__commandArgs | & $__handler + } + else { + $result = & "winget.exe" $__commandArgs + & $__handler $result + } + } + } # end PROCESS + +<# .SYNOPSIS Windows Package Manager (Preview) v1.3.1391-preview Copyright (c) Microsoft Corporation. All rights reserved. @@ -221,88 +233,105 @@ The following options are available: -v,--version Display the version of the tool --info Display general info of the tool -More help can be found at: https://aka.ms/winget-command-help - -.DESCRIPTION See help for winget.exe - -#> -} - - - - -function Disable-WinGetLocalManifest -{ -[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] -[CmdletBinding()] - -param( ) - -BEGIN { - $__PARAMETERMAP = @{} - $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } -} - -PROCESS { - $__boundParameters = $PSBoundParameters - $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name - $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) - $__commandArgs = @() - $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) - if ($__boundParameters["Debug"]){wait-debugger} - $__commandArgs += 'settings' - $__commandArgs += '--disable' - $__commandArgs += 'LocalManifestFiles' - foreach ($paramName in $__boundParameters.Keys| - Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| - Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { - $value = $__boundParameters[$paramName] - $param = $__PARAMETERMAP[$paramName] - if ($param) { - if ($value -is [switch]) { - if ($value.IsPresent) { - if ($param.OriginalName) { $__commandArgs += $param.OriginalName } - } - elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } - } - elseif ( $param.NoGap ) { - $pFmt = "{0}{1}" - if($value -match "\s") { $pFmt = "{0}""{1}""" } - $__commandArgs += $pFmt -f $param.OriginalName, $value - } - else { - if($param.OriginalName) { $__commandArgs += $param.OriginalName } - $__commandArgs += $value | Foreach-Object {$_} - } - } - } - $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} - if ($__boundParameters["Debug"]){wait-debugger} - if ( $__boundParameters["Verbose"]) { - Write-Verbose -Verbose -Message winget.exe - $__commandArgs | Write-Verbose -Verbose - } - $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] - if (! $__handlerInfo ) { - $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present - } - $__handler = $__handlerInfo.Handler - if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { - # check for the application and throw if it cannot be found - if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { - throw "Cannot find executable 'winget.exe'" - } - if ( $__handlerInfo.StreamOutput ) { - & "winget.exe" $__commandArgs | & $__handler - } - else { - $result = & "winget.exe" $__commandArgs - & $__handler $result - } - } - } # end PROCESS - -<# +More help can be found at: https://aka.ms/winget-command-help + +.DESCRIPTION See help for winget.exe + +.PARAMETER Name + + + + +#> +} + + + + +function Disable-WinGetSetting +{ +[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] +[CmdletBinding()] + +param( +[Parameter(Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Mandatory=$true)] +[string]$Name + ) + +BEGIN { + $__PARAMETERMAP = @{ + Name = @{ + OriginalName = '' + OriginalPosition = '0' + Position = '0' + ParameterType = 'string' + ApplyToExecutable = $False + NoGap = $False + } + } + + $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } +} + +PROCESS { + $__boundParameters = $PSBoundParameters + $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name + $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) + $__commandArgs = @() + $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) + if ($__boundParameters["Debug"]){wait-debugger} + $__commandArgs += 'settings' + $__commandArgs += '--disable' + foreach ($paramName in $__boundParameters.Keys| + Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| + Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { + $value = $__boundParameters[$paramName] + $param = $__PARAMETERMAP[$paramName] + if ($param) { + if ($value -is [switch]) { + if ($value.IsPresent) { + if ($param.OriginalName) { $__commandArgs += $param.OriginalName } + } + elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } + } + elseif ( $param.NoGap ) { + $pFmt = "{0}{1}" + if($value -match "\s") { $pFmt = "{0}""{1}""" } + $__commandArgs += $pFmt -f $param.OriginalName, $value + } + else { + if($param.OriginalName) { $__commandArgs += $param.OriginalName } + $__commandArgs += $value | Foreach-Object {$_} + } + } + } + $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} + if ($__boundParameters["Debug"]){wait-debugger} + if ( $__boundParameters["Verbose"]) { + Write-Verbose -Verbose -Message winget.exe + $__commandArgs | Write-Verbose -Verbose + } + $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] + if (! $__handlerInfo ) { + $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present + } + $__handler = $__handlerInfo.Handler + if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { + # check for the application and throw if it cannot be found + if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { + throw "Cannot find executable 'winget.exe'" + } + if ( $__handlerInfo.StreamOutput ) { + & "winget.exe" $__commandArgs | & $__handler + } + else { + $result = & "winget.exe" $__commandArgs + & $__handler $result + } + } + } # end PROCESS + +<# .SYNOPSIS Windows Package Manager (Preview) v1.3.1391-preview Copyright (c) Microsoft Corporation. All rights reserved. @@ -332,120 +361,125 @@ The following options are available: -v,--version Display the version of the tool --info Display general info of the tool -More help can be found at: https://aka.ms/winget-command-help - -.DESCRIPTION See help for winget.exe - -#> -} - - - - +More help can be found at: https://aka.ms/winget-command-help + +.DESCRIPTION See help for winget.exe + +.PARAMETER Name + + + + +#> +} + + + + function Add-WinGetSource -{ -[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] -[CmdletBinding()] - -param( -[Parameter(Position=0,ValueFromPipelineByPropertyName=$true,Mandatory=$true)] +{ +[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] +[CmdletBinding()] + +param( +[Parameter(Position=0,ValueFromPipelineByPropertyName=$true,Mandatory=$true)] [string]$Name, -[Parameter(Position=1,ValueFromPipelineByPropertyName=$true,Mandatory=$true)] +[Parameter(Position=1,ValueFromPipelineByPropertyName=$true,Mandatory=$true)] [string]$Argument, -[Parameter(Position=2,ValueFromPipelineByPropertyName=$true)] -[string]$Type - ) - -BEGIN { - $__PARAMETERMAP = @{ - Name = @{ - OriginalName = '--name' - OriginalPosition = '0' - Position = '0' - ParameterType = 'string' - ApplyToExecutable = $False - NoGap = $False - } - Argument = @{ - OriginalName = '--arg' - OriginalPosition = '0' - Position = '1' - ParameterType = 'string' - ApplyToExecutable = $False - NoGap = $False - } - Type = @{ - OriginalName = '--type' - OriginalPosition = '0' - Position = '2' - ParameterType = 'string' - ApplyToExecutable = $False - NoGap = $False - } - } - - $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } -} - -PROCESS { - $__boundParameters = $PSBoundParameters - $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name - $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) - $__commandArgs = @() - $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) - if ($__boundParameters["Debug"]){wait-debugger} - $__commandArgs += 'source' - $__commandArgs += 'add' - foreach ($paramName in $__boundParameters.Keys| - Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| - Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { - $value = $__boundParameters[$paramName] - $param = $__PARAMETERMAP[$paramName] - if ($param) { - if ($value -is [switch]) { - if ($value.IsPresent) { - if ($param.OriginalName) { $__commandArgs += $param.OriginalName } - } - elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } - } - elseif ( $param.NoGap ) { - $pFmt = "{0}{1}" - if($value -match "\s") { $pFmt = "{0}""{1}""" } - $__commandArgs += $pFmt -f $param.OriginalName, $value - } - else { - if($param.OriginalName) { $__commandArgs += $param.OriginalName } - $__commandArgs += $value | Foreach-Object {$_} - } - } - } - $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} - if ($__boundParameters["Debug"]){wait-debugger} - if ( $__boundParameters["Verbose"]) { - Write-Verbose -Verbose -Message winget.exe - $__commandArgs | Write-Verbose -Verbose - } - $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] - if (! $__handlerInfo ) { - $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present - } - $__handler = $__handlerInfo.Handler - if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { - # check for the application and throw if it cannot be found - if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { - throw "Cannot find executable 'winget.exe'" - } - if ( $__handlerInfo.StreamOutput ) { - & "winget.exe" $__commandArgs | & $__handler - } - else { - $result = & "winget.exe" $__commandArgs - & $__handler $result - } - } - } # end PROCESS - -<# +[Parameter(Position=2,ValueFromPipelineByPropertyName=$true)] +[string]$Type + ) + +BEGIN { + $__PARAMETERMAP = @{ + Name = @{ + OriginalName = '--name' + OriginalPosition = '0' + Position = '0' + ParameterType = 'string' + ApplyToExecutable = $False + NoGap = $False + } + Argument = @{ + OriginalName = '--arg' + OriginalPosition = '0' + Position = '1' + ParameterType = 'string' + ApplyToExecutable = $False + NoGap = $False + } + Type = @{ + OriginalName = '--type' + OriginalPosition = '0' + Position = '2' + ParameterType = 'string' + ApplyToExecutable = $False + NoGap = $False + } + } + + $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } +} + +PROCESS { + $__boundParameters = $PSBoundParameters + $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name + $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) + $__commandArgs = @() + $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) + if ($__boundParameters["Debug"]){wait-debugger} + $__commandArgs += 'source' + $__commandArgs += 'add' + foreach ($paramName in $__boundParameters.Keys| + Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| + Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { + $value = $__boundParameters[$paramName] + $param = $__PARAMETERMAP[$paramName] + if ($param) { + if ($value -is [switch]) { + if ($value.IsPresent) { + if ($param.OriginalName) { $__commandArgs += $param.OriginalName } + } + elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } + } + elseif ( $param.NoGap ) { + $pFmt = "{0}{1}" + if($value -match "\s") { $pFmt = "{0}""{1}""" } + $__commandArgs += $pFmt -f $param.OriginalName, $value + } + else { + if($param.OriginalName) { $__commandArgs += $param.OriginalName } + $__commandArgs += $value | Foreach-Object {$_} + } + } + } + $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} + if ($__boundParameters["Debug"]){wait-debugger} + if ( $__boundParameters["Verbose"]) { + Write-Verbose -Verbose -Message winget.exe + $__commandArgs | Write-Verbose -Verbose + } + $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] + if (! $__handlerInfo ) { + $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present + } + $__handler = $__handlerInfo.Handler + if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { + # check for the application and throw if it cannot be found + if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { + throw "Cannot find executable 'winget.exe'" + } + if ( $__handlerInfo.StreamOutput ) { + & "winget.exe" $__commandArgs | & $__handler + } + else { + $result = & "winget.exe" $__commandArgs + & $__handler $result + } + } + } # end PROCESS + +<# .SYNOPSIS Windows Package Manager (Preview) v1.3.1391-preview Copyright (c) Microsoft Corporation. All rights reserved. @@ -475,113 +509,113 @@ The following options are available: -v,--version Display the version of the tool --info Display general info of the tool -More help can be found at: https://aka.ms/winget-command-help - -.DESCRIPTION See help for winget.exe - -.PARAMETER Name - - - -.PARAMETER Argument - - - -.PARAMETER Type - - - - -#> -} - - - - +More help can be found at: https://aka.ms/winget-command-help + +.DESCRIPTION See help for winget.exe + +.PARAMETER Name + + + +.PARAMETER Argument + + + +.PARAMETER Type + + + + +#> +} + + + + function Remove-WinGetSource -{ -[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] -[CmdletBinding()] - -param( -[Parameter(Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Mandatory=$true)] -[string]$Name - ) - -BEGIN { - $__PARAMETERMAP = @{ - Name = @{ - OriginalName = '--name' - OriginalPosition = '0' - Position = '0' - ParameterType = 'string' - ApplyToExecutable = $False - NoGap = $False - } - } - - $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } -} - -PROCESS { - $__boundParameters = $PSBoundParameters - $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name - $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) - $__commandArgs = @() - $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) - if ($__boundParameters["Debug"]){wait-debugger} - $__commandArgs += 'source' - $__commandArgs += 'remove' - foreach ($paramName in $__boundParameters.Keys| - Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| - Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { - $value = $__boundParameters[$paramName] - $param = $__PARAMETERMAP[$paramName] - if ($param) { - if ($value -is [switch]) { - if ($value.IsPresent) { - if ($param.OriginalName) { $__commandArgs += $param.OriginalName } - } - elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } - } - elseif ( $param.NoGap ) { - $pFmt = "{0}{1}" - if($value -match "\s") { $pFmt = "{0}""{1}""" } - $__commandArgs += $pFmt -f $param.OriginalName, $value - } - else { - if($param.OriginalName) { $__commandArgs += $param.OriginalName } - $__commandArgs += $value | Foreach-Object {$_} - } - } - } - $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} - if ($__boundParameters["Debug"]){wait-debugger} - if ( $__boundParameters["Verbose"]) { - Write-Verbose -Verbose -Message winget.exe - $__commandArgs | Write-Verbose -Verbose - } - $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] - if (! $__handlerInfo ) { - $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present - } - $__handler = $__handlerInfo.Handler - if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { - # check for the application and throw if it cannot be found - if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { - throw "Cannot find executable 'winget.exe'" - } - if ( $__handlerInfo.StreamOutput ) { - & "winget.exe" $__commandArgs | & $__handler - } - else { - $result = & "winget.exe" $__commandArgs - & $__handler $result - } - } - } # end PROCESS - -<# +{ +[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] +[CmdletBinding()] + +param( +[Parameter(Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Mandatory=$true)] +[string]$Name + ) + +BEGIN { + $__PARAMETERMAP = @{ + Name = @{ + OriginalName = '--name' + OriginalPosition = '0' + Position = '0' + ParameterType = 'string' + ApplyToExecutable = $False + NoGap = $False + } + } + + $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } +} + +PROCESS { + $__boundParameters = $PSBoundParameters + $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name + $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) + $__commandArgs = @() + $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) + if ($__boundParameters["Debug"]){wait-debugger} + $__commandArgs += 'source' + $__commandArgs += 'remove' + foreach ($paramName in $__boundParameters.Keys| + Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| + Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { + $value = $__boundParameters[$paramName] + $param = $__PARAMETERMAP[$paramName] + if ($param) { + if ($value -is [switch]) { + if ($value.IsPresent) { + if ($param.OriginalName) { $__commandArgs += $param.OriginalName } + } + elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } + } + elseif ( $param.NoGap ) { + $pFmt = "{0}{1}" + if($value -match "\s") { $pFmt = "{0}""{1}""" } + $__commandArgs += $pFmt -f $param.OriginalName, $value + } + else { + if($param.OriginalName) { $__commandArgs += $param.OriginalName } + $__commandArgs += $value | Foreach-Object {$_} + } + } + } + $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} + if ($__boundParameters["Debug"]){wait-debugger} + if ( $__boundParameters["Verbose"]) { + Write-Verbose -Verbose -Message winget.exe + $__commandArgs | Write-Verbose -Verbose + } + $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] + if (! $__handlerInfo ) { + $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present + } + $__handler = $__handlerInfo.Handler + if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { + # check for the application and throw if it cannot be found + if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { + throw "Cannot find executable 'winget.exe'" + } + if ( $__handlerInfo.StreamOutput ) { + & "winget.exe" $__commandArgs | & $__handler + } + else { + $result = & "winget.exe" $__commandArgs + & $__handler $result + } + } + } # end PROCESS + +<# .SYNOPSIS Windows Package Manager (Preview) v1.3.1391-preview Copyright (c) Microsoft Corporation. All rights reserved. @@ -611,106 +645,106 @@ The following options are available: -v,--version Display the version of the tool --info Display general info of the tool -More help can be found at: https://aka.ms/winget-command-help - -.DESCRIPTION See help for winget.exe - -.PARAMETER Name - - - - -#> -} - - - - +More help can be found at: https://aka.ms/winget-command-help + +.DESCRIPTION See help for winget.exe + +.PARAMETER Name + + + + +#> +} + + + + function Reset-WinGetSource -{ -[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] -[CmdletBinding()] - -param( -[Parameter(Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)] -[string]$Name - ) - -BEGIN { - $__PARAMETERMAP = @{ - Name = @{ - OriginalName = '--name' - OriginalPosition = '0' - Position = '0' - ParameterType = 'string' - ApplyToExecutable = $False - NoGap = $False - } - } - - $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } -} - -PROCESS { - $__boundParameters = $PSBoundParameters - $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name - $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) - $__commandArgs = @() - $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) - if ($__boundParameters["Debug"]){wait-debugger} - $__commandArgs += 'source' - $__commandArgs += 'reset' - $__commandArgs += '--force' - foreach ($paramName in $__boundParameters.Keys| - Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| - Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { - $value = $__boundParameters[$paramName] - $param = $__PARAMETERMAP[$paramName] - if ($param) { - if ($value -is [switch]) { - if ($value.IsPresent) { - if ($param.OriginalName) { $__commandArgs += $param.OriginalName } - } - elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } - } - elseif ( $param.NoGap ) { - $pFmt = "{0}{1}" - if($value -match "\s") { $pFmt = "{0}""{1}""" } - $__commandArgs += $pFmt -f $param.OriginalName, $value - } - else { - if($param.OriginalName) { $__commandArgs += $param.OriginalName } - $__commandArgs += $value | Foreach-Object {$_} - } - } - } - $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} - if ($__boundParameters["Debug"]){wait-debugger} - if ( $__boundParameters["Verbose"]) { - Write-Verbose -Verbose -Message winget.exe - $__commandArgs | Write-Verbose -Verbose - } - $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] - if (! $__handlerInfo ) { - $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present - } - $__handler = $__handlerInfo.Handler - if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { - # check for the application and throw if it cannot be found - if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { - throw "Cannot find executable 'winget.exe'" - } - if ( $__handlerInfo.StreamOutput ) { - & "winget.exe" $__commandArgs | & $__handler - } - else { - $result = & "winget.exe" $__commandArgs - & $__handler $result - } - } - } # end PROCESS - -<# +{ +[PowerShellCustomFunctionAttribute(RequiresElevation=$False)] +[CmdletBinding()] + +param( +[Parameter(Position=0,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)] +[string]$Name + ) + +BEGIN { + $__PARAMETERMAP = @{ + Name = @{ + OriginalName = '--name' + OriginalPosition = '0' + Position = '0' + ParameterType = 'string' + ApplyToExecutable = $False + NoGap = $False + } + } + + $__outputHandlers = @{ Default = @{ StreamOutput = $true; Handler = { $input } } } +} + +PROCESS { + $__boundParameters = $PSBoundParameters + $__defaultValueParameters = $PSCmdlet.MyInvocation.MyCommand.Parameters.Values.Where({$_.Attributes.Where({$_.TypeId.Name -eq "PSDefaultValueAttribute"})}).Name + $__defaultValueParameters.Where({ !$__boundParameters["$_"] }).ForEach({$__boundParameters["$_"] = get-variable -value $_}) + $__commandArgs = @() + $MyInvocation.MyCommand.Parameters.Values.Where({$_.SwitchParameter -and $_.Name -notmatch "Debug|Whatif|Confirm|Verbose" -and ! $__boundParameters[$_.Name]}).ForEach({$__boundParameters[$_.Name] = [switch]::new($false)}) + if ($__boundParameters["Debug"]){wait-debugger} + $__commandArgs += 'source' + $__commandArgs += 'reset' + $__commandArgs += '--force' + foreach ($paramName in $__boundParameters.Keys| + Where-Object {!$__PARAMETERMAP[$_].ApplyToExecutable}| + Sort-Object {$__PARAMETERMAP[$_].OriginalPosition}) { + $value = $__boundParameters[$paramName] + $param = $__PARAMETERMAP[$paramName] + if ($param) { + if ($value -is [switch]) { + if ($value.IsPresent) { + if ($param.OriginalName) { $__commandArgs += $param.OriginalName } + } + elseif ($param.DefaultMissingValue) { $__commandArgs += $param.DefaultMissingValue } + } + elseif ( $param.NoGap ) { + $pFmt = "{0}{1}" + if($value -match "\s") { $pFmt = "{0}""{1}""" } + $__commandArgs += $pFmt -f $param.OriginalName, $value + } + else { + if($param.OriginalName) { $__commandArgs += $param.OriginalName } + $__commandArgs += $value | Foreach-Object {$_} + } + } + } + $__commandArgs = $__commandArgs | Where-Object {$_ -ne $null} + if ($__boundParameters["Debug"]){wait-debugger} + if ( $__boundParameters["Verbose"]) { + Write-Verbose -Verbose -Message winget.exe + $__commandArgs | Write-Verbose -Verbose + } + $__handlerInfo = $__outputHandlers[$PSCmdlet.ParameterSetName] + if (! $__handlerInfo ) { + $__handlerInfo = $__outputHandlers["Default"] # Guaranteed to be present + } + $__handler = $__handlerInfo.Handler + if ( $PSCmdlet.ShouldProcess("winget.exe $__commandArgs")) { + # check for the application and throw if it cannot be found + if ( -not (Get-Command -ErrorAction Ignore "winget.exe")) { + throw "Cannot find executable 'winget.exe'" + } + if ( $__handlerInfo.StreamOutput ) { + & "winget.exe" $__commandArgs | & $__handler + } + else { + $result = & "winget.exe" $__commandArgs + & $__handler $result + } + } + } # end PROCESS + +<# .SYNOPSIS Windows Package Manager (Preview) v1.3.1391-preview Copyright (c) Microsoft Corporation. All rights reserved. @@ -740,16 +774,16 @@ The following options are available: -v,--version Display the version of the tool --info Display general info of the tool -More help can be found at: https://aka.ms/winget-command-help - -.DESCRIPTION See help for winget.exe - -.PARAMETER Name - - - - -#> -} - - +More help can be found at: https://aka.ms/winget-command-help + +.DESCRIPTION See help for winget.exe + +.PARAMETER Name + + + + +#> +} + + diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Add-WinGetSource.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Add-WinGetSource.md deleted file mode 100644 index 680d9032a9..0000000000 --- a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Add-WinGetSource.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client-help.xml -Module Name: Microsoft.WinGet.Client -online version: -schema: 2.0.0 ---- - -# Add-WinGetSource - -## SYNOPSIS -{{ Fill in the Synopsis }} - -## SYNTAX - -``` -Add-WinGetSource [-Name] [-Argument] [[-Type] ] [] -``` - -## DESCRIPTION -{{ Fill in the Description }} - -## EXAMPLES - -### Example 1 -```powershell -PS C:\> {{ Add example code here }} -``` - -{{ Add example description here }} - -## PARAMETERS - -### -Argument -{{ Fill Argument Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: 1 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Name -{{ Fill Name Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Type -{{ Fill Type Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: 2 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.String - -## OUTPUTS - -### System.Object -## NOTES - -## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Disable-WinGetLocalManifest.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Disable-WinGetLocalManifest.md deleted file mode 100644 index 4f91f7ac51..0000000000 --- a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Disable-WinGetLocalManifest.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client-help.xml -Module Name: Microsoft.WinGet.Client -online version: -schema: 2.0.0 ---- - -# Disable-WinGetLocalManifest - -## SYNOPSIS -{{ Fill in the Synopsis }} - -## SYNTAX - -``` -Disable-WinGetLocalManifest [] -``` - -## DESCRIPTION -{{ Fill in the Description }} - -## EXAMPLES - -### Example 1 -```powershell -PS C:\> {{ Add example code here }} -``` - -{{ Add example description here }} - -## PARAMETERS - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### None - -## OUTPUTS - -### System.Object -## NOTES - -## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Enable-WinGetLocalManifest.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Enable-WinGetLocalManifest.md deleted file mode 100644 index d9966cfeb4..0000000000 --- a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Enable-WinGetLocalManifest.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client-help.xml -Module Name: Microsoft.WinGet.Client -online version: -schema: 2.0.0 ---- - -# Enable-WinGetLocalManifest - -## SYNOPSIS -{{ Fill in the Synopsis }} - -## SYNTAX - -``` -Enable-WinGetLocalManifest [] -``` - -## DESCRIPTION -{{ Fill in the Description }} - -## EXAMPLES - -### Example 1 -```powershell -PS C:\> {{ Add example code here }} -``` - -{{ Add example description here }} - -## PARAMETERS - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### None - -## OUTPUTS - -### System.Object -## NOTES - -## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Find-WinGetPackage.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Find-WinGetPackage.md deleted file mode 100644 index 7d36d22b06..0000000000 --- a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Find-WinGetPackage.md +++ /dev/null @@ -1,188 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client.dll-Help.xml -Module Name: Microsoft.WinGet.Client -online version: -schema: 2.0.0 ---- - -# Find-WinGetPackage - -## SYNOPSIS -{{ Fill in the Synopsis }} - -## SYNTAX - -``` -Find-WinGetPackage [-Tag ] [-Command ] [-Count ] [-Id ] [-Name ] - [-Moniker ] [-Source ] [[-Query] ] [-Exact] [] -``` - -## DESCRIPTION -{{ Fill in the Description }} - -## EXAMPLES - -### Example 1 -```powershell -PS C:\> {{ Add example code here }} -``` - -{{ Add example description here }} - -## PARAMETERS - -### -Command -{{ Fill Command Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Count -{{ Fill Count Description }} - -```yaml -Type: UInt32 -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Exact -{{ Fill Exact Description }} - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Id -{{ Fill Id Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Moniker -{{ Fill Moniker Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Name -{{ Fill Name Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Query -{{ Fill Query Description }} - -```yaml -Type: String[] -Parameter Sets: (All) -Aliases: - -Required: False -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Source -{{ Fill Source Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Tag -{{ Fill Tag Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.String - -### System.UInt32 - -### System.String[] - -### System.Management.Automation.SwitchParameter - -## OUTPUTS - -### Microsoft.Management.Deployment.MatchResult - -## NOTES - -## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetPackage.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetPackage.md deleted file mode 100644 index 1b579c8f11..0000000000 --- a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetPackage.md +++ /dev/null @@ -1,188 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client.dll-Help.xml -Module Name: Microsoft.WinGet.Client -online version: -schema: 2.0.0 ---- - -# Get-WinGetPackage - -## SYNOPSIS -{{ Fill in the Synopsis }} - -## SYNTAX - -``` -Get-WinGetPackage [-Tag ] [-Command ] [-Count ] [-Id ] [-Name ] - [-Moniker ] [-Source ] [[-Query] ] [-Exact] [] -``` - -## DESCRIPTION -{{ Fill in the Description }} - -## EXAMPLES - -### Example 1 -```powershell -PS C:\> {{ Add example code here }} -``` - -{{ Add example description here }} - -## PARAMETERS - -### -Command -{{ Fill Command Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Count -{{ Fill Count Description }} - -```yaml -Type: UInt32 -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Exact -{{ Fill Exact Description }} - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Id -{{ Fill Id Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Moniker -{{ Fill Moniker Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Name -{{ Fill Name Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Query -{{ Fill Query Description }} - -```yaml -Type: String[] -Parameter Sets: (All) -Aliases: - -Required: False -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Source -{{ Fill Source Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Tag -{{ Fill Tag Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.String - -### System.UInt32 - -### System.String[] - -### System.Management.Automation.SwitchParameter - -## OUTPUTS - -### Microsoft.Management.Deployment.CatalogPackage - -## NOTES - -## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetSource.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetSource.md deleted file mode 100644 index fb663b927d..0000000000 --- a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetSource.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client.dll-Help.xml -Module Name: Microsoft.WinGet.Client -online version: -schema: 2.0.0 ---- - -# Get-WinGetSource - -## SYNOPSIS -{{ Fill in the Synopsis }} - -## SYNTAX - -``` -Get-WinGetSource [[-Name] ] [] -``` - -## DESCRIPTION -{{ Fill in the Description }} - -## EXAMPLES - -### Example 1 -```powershell -PS C:\> {{ Add example code here }} -``` - -{{ Add example description here }} - -## PARAMETERS - -### -Name -{{ Fill Name Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.String - -## OUTPUTS - -### Microsoft.Management.Deployment.PackageCatalogReference - -## NOTES - -## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetVersion.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetVersion.md deleted file mode 100644 index 7f057a6425..0000000000 --- a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Get-WinGetVersion.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client-help.xml -Module Name: Microsoft.WinGet.Client -online version: -schema: 2.0.0 ---- - -# Get-WinGetVersion - -## SYNOPSIS -{{ Fill in the Synopsis }} - -## SYNTAX - -``` -Get-WinGetVersion [] -``` - -## DESCRIPTION -{{ Fill in the Description }} - -## EXAMPLES - -### Example 1 -```powershell -PS C:\> {{ Add example code here }} -``` - -{{ Add example description here }} - -## PARAMETERS - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### None - -## OUTPUTS - -### System.Object -## NOTES - -## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Install-WinGetPackage.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Install-WinGetPackage.md deleted file mode 100644 index 8698c63ea3..0000000000 --- a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Install-WinGetPackage.md +++ /dev/null @@ -1,344 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client.dll-Help.xml -Module Name: Microsoft.WinGet.Client -online version: -schema: 2.0.0 ---- - -# Install-WinGetPackage - -## SYNOPSIS -{{ Fill in the Synopsis }} - -## SYNTAX - -### FoundSet (Default) -``` -Install-WinGetPackage [-Scope ] [-Architecture ] - [-Mode ] [-Override ] [-Location ] [-Force] [-Header ] - [-Version ] [-Log ] [-Id ] [-Name ] [-Moniker ] [-Source ] - [[-Query] ] [-Exact] [-WhatIf] [-Confirm] [] -``` - -### GivenSet -``` -Install-WinGetPackage [-Scope ] [-Architecture ] - [-Mode ] [-Override ] [-Location ] [-Force] [-Header ] - [[-CatalogPackage] ] [-Version ] [-Log ] [-WhatIf] [-Confirm] - [] -``` - -## DESCRIPTION -{{ Fill in the Description }} - -## EXAMPLES - -### Example 1 -```powershell -PS C:\> {{ Add example code here }} -``` - -{{ Add example description here }} - -## PARAMETERS - -### -Architecture -{{ Fill Architecture Description }} - -```yaml -Type: ProcessorArchitecture -Parameter Sets: (All) -Aliases: -Accepted values: X86, Arm, X64, Neutral, Arm64, X86OnArm64, Unknown - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -CatalogPackage -{{ Fill CatalogPackage Description }} - -```yaml -Type: CatalogPackage -Parameter Sets: GivenSet -Aliases: InputObject - -Required: False -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - -### -Confirm -Prompts you for confirmation before running the cmdlet. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: cf - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Exact -{{ Fill Exact Description }} - -```yaml -Type: SwitchParameter -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Force -{{ Fill Force Description }} - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Header -{{ Fill Header Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Id -{{ Fill Id Description }} - -```yaml -Type: String -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Location -{{ Fill Location Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Log -{{ Fill Log Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Mode -{{ Fill Mode Description }} - -```yaml -Type: PackageInstallMode -Parameter Sets: (All) -Aliases: -Accepted values: Default, Silent, Interactive - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Moniker -{{ Fill Moniker Description }} - -```yaml -Type: String -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Name -{{ Fill Name Description }} - -```yaml -Type: String -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Override -{{ Fill Override Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Query -{{ Fill Query Description }} - -```yaml -Type: String[] -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Scope -{{ Fill Scope Description }} - -```yaml -Type: PackageInstallScope -Parameter Sets: (All) -Aliases: -Accepted values: Any, User, System - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Source -{{ Fill Source Description }} - -```yaml -Type: String -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Version -{{ Fill Version Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -WhatIf -Shows what would happen if the cmdlet runs. -The cmdlet is not run. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: wi - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### Microsoft.Management.Deployment.PackageInstallScope - -### Windows.System.ProcessorArchitecture - -### Microsoft.Management.Deployment.PackageInstallMode - -### System.String - -### System.Management.Automation.SwitchParameter - -### Microsoft.Management.Deployment.CatalogPackage - -### System.String[] - -## OUTPUTS - -### Microsoft.Management.Deployment.InstallResult - -## NOTES - -## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Remove-WinGetSource.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Remove-WinGetSource.md deleted file mode 100644 index 69c60ec458..0000000000 --- a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Remove-WinGetSource.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client-help.xml -Module Name: Microsoft.WinGet.Client -online version: -schema: 2.0.0 ---- - -# Remove-WinGetSource - -## SYNOPSIS -{{ Fill in the Synopsis }} - -## SYNTAX - -``` -Remove-WinGetSource [-Name] [] -``` - -## DESCRIPTION -{{ Fill in the Description }} - -## EXAMPLES - -### Example 1 -```powershell -PS C:\> {{ Add example code here }} -``` - -{{ Add example description here }} - -## PARAMETERS - -### -Name -{{ Fill Name Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.String - -## OUTPUTS - -### System.Object -## NOTES - -## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Reset-WinGetSource.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Reset-WinGetSource.md deleted file mode 100644 index 41c37987c6..0000000000 --- a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Reset-WinGetSource.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client-help.xml -Module Name: Microsoft.WinGet.Client -online version: -schema: 2.0.0 ---- - -# Reset-WinGetSource - -## SYNOPSIS -{{ Fill in the Synopsis }} - -## SYNTAX - -``` -Reset-WinGetSource [[-Name] ] [] -``` - -## DESCRIPTION -{{ Fill in the Description }} - -## EXAMPLES - -### Example 1 -```powershell -PS C:\> {{ Add example code here }} -``` - -{{ Add example description here }} - -## PARAMETERS - -### -Name -{{ Fill Name Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.String - -## OUTPUTS - -### System.Object -## NOTES - -## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Uninstall-WinGetPackage.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Uninstall-WinGetPackage.md deleted file mode 100644 index 20e442ce80..0000000000 --- a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Uninstall-WinGetPackage.md +++ /dev/null @@ -1,245 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client.dll-Help.xml -Module Name: Microsoft.WinGet.Client -online version: -schema: 2.0.0 ---- - -# Uninstall-WinGetPackage - -## SYNOPSIS -{{ Fill in the Synopsis }} - -## SYNTAX - -### FoundSet (Default) -``` -Uninstall-WinGetPackage [-Mode ] [-Version ] [-Log ] [-Id ] - [-Name ] [-Moniker ] [-Source ] [[-Query] ] [-Exact] [-WhatIf] [-Confirm] - [] -``` - -### GivenSet -``` -Uninstall-WinGetPackage [-Mode ] [[-CatalogPackage] ] [-Version ] - [-Log ] [-WhatIf] [-Confirm] [] -``` - -## DESCRIPTION -{{ Fill in the Description }} - -## EXAMPLES - -### Example 1 -```powershell -PS C:\> {{ Add example code here }} -``` - -{{ Add example description here }} - -## PARAMETERS - -### -CatalogPackage -{{ Fill CatalogPackage Description }} - -```yaml -Type: CatalogPackage -Parameter Sets: GivenSet -Aliases: InputObject - -Required: False -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - -### -Confirm -Prompts you for confirmation before running the cmdlet. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: cf - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Exact -{{ Fill Exact Description }} - -```yaml -Type: SwitchParameter -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Id -{{ Fill Id Description }} - -```yaml -Type: String -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Log -{{ Fill Log Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Mode -{{ Fill Mode Description }} - -```yaml -Type: PackageUninstallMode -Parameter Sets: (All) -Aliases: -Accepted values: Default, Silent, Interactive - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Moniker -{{ Fill Moniker Description }} - -```yaml -Type: String -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Name -{{ Fill Name Description }} - -```yaml -Type: String -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Query -{{ Fill Query Description }} - -```yaml -Type: String[] -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Source -{{ Fill Source Description }} - -```yaml -Type: String -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Version -{{ Fill Version Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -WhatIf -Shows what would happen if the cmdlet runs. -The cmdlet is not run. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: wi - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### Microsoft.Management.Deployment.PackageUninstallMode - -### Microsoft.Management.Deployment.CatalogPackage - -### System.String - -### System.String[] - -### System.Management.Automation.SwitchParameter - -## OUTPUTS - -### Microsoft.Management.Deployment.UninstallResult - -## NOTES - -## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Update-WinGetPackage.md b/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Update-WinGetPackage.md deleted file mode 100644 index 6bcff3edd4..0000000000 --- a/src/PowerShell/Microsoft.WinGet.Client/PlatyPS/en-US/Update-WinGetPackage.md +++ /dev/null @@ -1,322 +0,0 @@ ---- -external help file: Microsoft.WinGet.Client.dll-Help.xml -Module Name: Microsoft.WinGet.Client -online version: -schema: 2.0.0 ---- - -# Update-WinGetPackage - -## SYNOPSIS -{{ Fill in the Synopsis }} - -## SYNTAX - -### FoundSet (Default) -``` -Update-WinGetPackage [-IncludeUnknown] [-Mode ] [-Override ] [-Location ] - [-Force] [-Header ] [-Version ] [-Log ] [-Id ] [-Name ] - [-Moniker ] [-Source ] [[-Query] ] [-Exact] [-WhatIf] [-Confirm] - [] -``` - -### GivenSet -``` -Update-WinGetPackage [-IncludeUnknown] [-Mode ] [-Override ] [-Location ] - [-Force] [-Header ] [[-CatalogPackage] ] [-Version ] [-Log ] [-WhatIf] - [-Confirm] [] -``` - -## DESCRIPTION -{{ Fill in the Description }} - -## EXAMPLES - -### Example 1 -```powershell -PS C:\> {{ Add example code here }} -``` - -{{ Add example description here }} - -## PARAMETERS - -### -CatalogPackage -{{ Fill CatalogPackage Description }} - -```yaml -Type: CatalogPackage -Parameter Sets: GivenSet -Aliases: InputObject - -Required: False -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - -### -Confirm -Prompts you for confirmation before running the cmdlet. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: cf - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Exact -{{ Fill Exact Description }} - -```yaml -Type: SwitchParameter -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Force -{{ Fill Force Description }} - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Header -{{ Fill Header Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Id -{{ Fill Id Description }} - -```yaml -Type: String -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -IncludeUnknown -{{ Fill IncludeUnknown Description }} - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Location -{{ Fill Location Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Log -{{ Fill Log Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Mode -{{ Fill Mode Description }} - -```yaml -Type: PackageInstallMode -Parameter Sets: (All) -Aliases: -Accepted values: Default, Silent, Interactive - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Moniker -{{ Fill Moniker Description }} - -```yaml -Type: String -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Name -{{ Fill Name Description }} - -```yaml -Type: String -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Override -{{ Fill Override Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Query -{{ Fill Query Description }} - -```yaml -Type: String[] -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Source -{{ Fill Source Description }} - -```yaml -Type: String -Parameter Sets: FoundSet -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Version -{{ Fill Version Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -WhatIf -Shows what would happen if the cmdlet runs. -The cmdlet is not run. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: wi - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.Management.Automation.SwitchParameter - -### Microsoft.Management.Deployment.PackageInstallMode - -### System.String - -### Microsoft.Management.Deployment.CatalogPackage - -### System.String[] - -## OUTPUTS - -### Microsoft.Management.Deployment.InstallResult - -## NOTES - -## RELATED LINKS diff --git a/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.Designer.cs b/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.Designer.cs similarity index 95% rename from src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.Designer.cs rename to src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.Designer.cs index 4660212397..d924c28c6d 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.Designer.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.Designer.cs @@ -1,126 +1,126 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.WinGet.Client.Resources { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.WinGet.Client.Resources.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to There was an error connecting to the source.. - /// - internal static string ExceptionMessages_CatalogError { - get { - return ResourceManager.GetString("ExceptionMessages_CatalogError", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to This cmdlet is currently not available in an administrator context.. - /// - internal static string ExceptionMessages_NoAdmin { - get { - return ResourceManager.GetString("ExceptionMessages_NoAdmin", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No packages matched the given input criteria.. - /// - internal static string ExceptionMessages_NoPackagesFound { - get { - return ResourceManager.GetString("ExceptionMessages_NoPackagesFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to There was an error searching for packages.. - /// - internal static string ExceptionMessages_SearchFailure { - get { - return ResourceManager.GetString("ExceptionMessages_SearchFailure", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to A source with the given name was not found.. - /// - internal static string ExceptionMessages_SourceNotFound { - get { - return ResourceManager.GetString("ExceptionMessages_SourceNotFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to '{0}', '{1}', and {2} other package(s) matched the input criteria. Please refine the input.. - /// - internal static string ExceptionMessages_VagueSearch { - get { - return ResourceManager.GetString("ExceptionMessages_VagueSearch", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No version matched the given input criteria.. - /// - internal static string ExceptionMessages_VersionNotFound { - get { - return ResourceManager.GetString("ExceptionMessages_VersionNotFound", resourceCulture); - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.WinGet.Client.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.WinGet.Client.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to There was an error connecting to the source.. + /// + internal static string ExceptionMessages_CatalogError { + get { + return ResourceManager.GetString("ExceptionMessages_CatalogError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This cmdlet is currently not available in an administrator context.. + /// + internal static string ExceptionMessages_NoAdmin { + get { + return ResourceManager.GetString("ExceptionMessages_NoAdmin", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No packages matched the given input criteria.. + /// + internal static string ExceptionMessages_NoPackagesFound { + get { + return ResourceManager.GetString("ExceptionMessages_NoPackagesFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There was an error searching for packages.. + /// + internal static string ExceptionMessages_SearchFailure { + get { + return ResourceManager.GetString("ExceptionMessages_SearchFailure", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A source with the given name was not found.. + /// + internal static string ExceptionMessages_SourceNotFound { + get { + return ResourceManager.GetString("ExceptionMessages_SourceNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to '{0}', '{1}', and {2} other package(s) matched the input criteria. Please refine the input.. + /// + internal static string ExceptionMessages_VagueSearch { + get { + return ResourceManager.GetString("ExceptionMessages_VagueSearch", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No version matched the given input criteria.. + /// + internal static string ExceptionMessages_VersionNotFound { + get { + return ResourceManager.GetString("ExceptionMessages_VersionNotFound", resourceCulture); + } + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.resx b/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.resx similarity index 100% rename from src/PowerShell/Microsoft.WinGet.Client/Resources/Resources.resx rename to src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.resx diff --git a/src/PowerShell/Microsoft.WinGet.Client/README.md b/src/PowerShell/Microsoft.WinGet.Client/README.md index 6d950f07fd..2f862f2178 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/README.md +++ b/src/PowerShell/Microsoft.WinGet.Client/README.md @@ -22,4 +22,4 @@ to make sure of the following steps. Once you've done all of the pre-requisite steps, you can build the PowerShell module folder by running the PowerShell build script. For example, -- `.\BuildModule.ps1 -In bin -Out build\bin -Configuration Release` +- `.\Build-Module.ps1 -In bin -Out build\bin -Configuration Release` From 91f8a4a8c2069f91b571023f99e22e3ee25b1c47 Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Tue, 19 Jul 2022 12:46:31 -0700 Subject: [PATCH 12/21] Minor changes and lower minimum platform version --- .../Commands/BaseClientCommand.cs | 10 ++++++---- .../Microsoft.WinGet.Client.csproj | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseClientCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseClientCommand.cs index f396e99bc6..4fd6204c50 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseClientCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseClientCommand.cs @@ -41,10 +41,12 @@ public BaseClientCommand() /// /// Gets the instance of the class. /// - protected static Lazy PackageManager { get; } = new Lazy(() => ComObjectFactory.Value.CreatePackageManager()); - - private static bool InitializedUndockedRegFreeWinRT { get; set; } = InitializeUndockedRegFreeWinRT(); - + protected static Lazy PackageManager { get; } = new Lazy(() => ComObjectFactory.Value.CreatePackageManager()); + +#pragma warning disable IDE0051 // Remove unused private members + private static bool InitializedUndockedRegFreeWinRT { get; set; } = InitializeUndockedRegFreeWinRT(); +#pragma warning restore IDE0051 // Remove unused private members + /// /// Retrieves the specified source or all sources if is null. /// diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj index b7b8d0ed53..e8cb8a48ce 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj @@ -39,7 +39,7 @@ - + True True Resources.resx @@ -47,7 +47,7 @@ - + ResXFileCodeGenerator Resources.Designer.cs @@ -56,6 +56,8 @@ Microsoft.Management.Deployment 10.0.22000.0 + + 10.0.17763.0 \ No newline at end of file From b6a7ec7057db23d76ae51c31565daf5d17c36555 Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Tue, 19 Jul 2022 16:04:47 -0700 Subject: [PATCH 13/21] Organize and enhance comments --- .../Commands/FindPackageCommand.cs | 2 +- .../Commands/GetPackageCommand.cs | 2 +- .../Commands/GetSourceCommand.cs | 2 +- .../Commands/InstallPackageCommand.cs | 11 +- .../Commands/UninstallPackageCommand.cs | 30 +- .../Commands/UpdatePackageCommand.cs | 12 +- .../{Commands => Common}/BaseClientCommand.cs | 152 +++---- .../{Commands => Common}/BaseFinderCommand.cs | 420 +++++++++--------- .../BaseFinderExtendedCommand.cs | 7 +- .../BaseInstallCommand.cs | 34 +- .../BasePackageCommand.cs} | 53 ++- .../{Helpers => Common}/Constants.cs | 21 +- .../Common/Utilities.cs | 43 ++ .../Errors/FindPackagesException.cs | 6 +- .../Errors/VagueCriteriaException.cs | 10 +- .../Helpers/CatalogPackageExtensions.cs | 4 +- .../ComObjectFactory.cs | 27 +- .../FilterAttribute.cs | 4 +- .../Helpers/WriteProgressAdapter.cs | 8 +- .../Microsoft.WinGet.Client.csproj | 131 +++--- ...urces.Designer.cs => Resource.Designer.cs} | 48 +- .../{Resources.resx => Resource.resx} | 284 ++++++------ 22 files changed, 657 insertions(+), 654 deletions(-) rename src/PowerShell/Microsoft.WinGet.Client/{Commands => Common}/BaseClientCommand.cs (57%) rename src/PowerShell/Microsoft.WinGet.Client/{Commands => Common}/BaseFinderCommand.cs (82%) rename src/PowerShell/Microsoft.WinGet.Client/{Commands => Common}/BaseFinderExtendedCommand.cs (88%) rename src/PowerShell/Microsoft.WinGet.Client/{Commands => Common}/BaseInstallCommand.cs (86%) rename src/PowerShell/Microsoft.WinGet.Client/{Commands/BaseLifecycleCommand.cs => Common/BasePackageCommand.cs} (66%) rename src/PowerShell/Microsoft.WinGet.Client/{Helpers => Common}/Constants.cs (74%) create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Common/Utilities.cs rename src/PowerShell/Microsoft.WinGet.Client/{Factories => Helpers}/ComObjectFactory.cs (86%) rename src/PowerShell/Microsoft.WinGet.Client/{Attributes => Helpers}/FilterAttribute.cs (73%) rename src/PowerShell/Microsoft.WinGet.Client/Properties/{Resources.Designer.cs => Resource.Designer.cs} (63%) rename src/PowerShell/Microsoft.WinGet.Client/Properties/{Resources.resx => Resource.resx} (79%) diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/FindPackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/FindPackageCommand.cs index ba14e6c196..73bc509c4a 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/FindPackageCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/FindPackageCommand.cs @@ -8,7 +8,7 @@ namespace Microsoft.WinGet.Client.Commands { using System.Management.Automation; using Microsoft.Management.Deployment; - using Microsoft.WinGet.Client.Helpers; + using Microsoft.WinGet.Client.Common; /// /// Searches configured sources for packages. diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/GetPackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/GetPackageCommand.cs index 4a685c1934..aa0a290058 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/GetPackageCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/GetPackageCommand.cs @@ -8,7 +8,7 @@ namespace Microsoft.WinGet.Client.Commands { using System.Management.Automation; using Microsoft.Management.Deployment; - using Microsoft.WinGet.Client.Helpers; + using Microsoft.WinGet.Client.Common; /// /// Searches configured sources for packages. diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/GetSourceCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/GetSourceCommand.cs index e4f043557e..1daaeca661 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/GetSourceCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/GetSourceCommand.cs @@ -9,7 +9,7 @@ namespace Microsoft.WinGet.Client.Commands using System; using System.Management.Automation; using Microsoft.Management.Deployment; - using Microsoft.WinGet.Client.Helpers; + using Microsoft.WinGet.Client.Common; /// /// Retrieves the list of configured sources. diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs index 6aa731ab62..776db8ca29 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs @@ -12,7 +12,7 @@ namespace Microsoft.WinGet.Client.Commands { using System.Management.Automation; using Microsoft.Management.Deployment; - using Microsoft.WinGet.Client.Helpers; + using Microsoft.WinGet.Client.Common; /// /// Installs a package from the pipeline or from a configured source. @@ -65,17 +65,16 @@ protected override void ProcessRecord() base.ProcessRecord(); this.GetPackageAndExecute(CompositeSearchBehavior.RemotePackagesFromRemoteCatalogs, (package, version) => { - var options = this.GetInstallOptions(version); - var results = this.InstallPackage(package, options); - this.WriteObject(results); + InstallOptions options = this.GetInstallOptions(version); + InstallResult result = this.InstallPackage(package, options); + this.WriteObject(result); }); } /// protected override InstallOptions GetInstallOptions(PackageVersionId version) { - var options = base.GetInstallOptions(version); - + InstallOptions options = base.GetInstallOptions(version); if (this.architectureGiven) { options.AllowedArchitectures.Clear(); diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs index ad1c2bb937..8ee919780d 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs @@ -9,6 +9,7 @@ namespace Microsoft.WinGet.Client.Commands using System; using System.Management.Automation; using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Common; using Microsoft.WinGet.Client.Helpers; /// @@ -20,7 +21,7 @@ namespace Microsoft.WinGet.Client.Commands DefaultParameterSetName = Constants.FoundSet, SupportsShouldProcess = true)] [OutputType(typeof(UninstallResult))] - public sealed class UninstallPackageCommand : BaseLifecycleCommand + public sealed class UninstallPackageCommand : BasePackageCommand { /// /// Gets or sets the desired mode for the uninstallation process. @@ -35,23 +36,21 @@ protected override void ProcessRecord() { this.GetPackageAndExecute(CompositeSearchBehavior.LocalCatalogs, (package, version) => { - var options = this.GetUninstallOptions(version); - var results = this.UninstallPackage(package, options); - this.WriteObject(results); + UninstallOptions options = this.GetUninstallOptions(version); + UninstallResult result = this.UninstallPackage(package, options); + this.WriteObject(result); }); } private UninstallOptions GetUninstallOptions(PackageVersionId version) { var options = ComObjectFactory.Value.CreateUninstallOptions(); - if (this.Log != null) { options.LogOutputPath = this.Log; } options.PackageUninstallMode = this.Mode; - if (version != null) { options.PackageVersionId = version; @@ -65,36 +64,27 @@ private UninstallResult UninstallPackage( UninstallOptions options) { string activity = $"Uninstalling '{package.Name}'"; - var operation = PackageManager.Value.UninstallPackageAsync(package, options); - var adapter = new WriteProgressAdapter(this); - + WriteProgressAdapter adapter = new (this); operation.Progress = (context, progress) => { - var record = new ProgressRecord(1, activity, progress.State.ToString()) + adapter.WriteProgress(new ProgressRecord(1, activity, progress.State.ToString()) { RecordType = ProgressRecordType.Processing, - }; - - adapter.WriteProgress(record); + }); }; - operation.Completed = (context, status) => { - var record = new ProgressRecord(1, activity, status.ToString()) + adapter.WriteProgress(new ProgressRecord(1, activity, status.ToString()) { RecordType = ProgressRecordType.Completed, - }; - - adapter.WriteProgress(record); + }); adapter.Completed = true; }; - Console.CancelKeyPress += (sender, e) => { operation.Cancel(); }; - adapter.Wait(); return operation.GetResults(); } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs index c6b195231c..9a2074656c 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs @@ -8,7 +8,7 @@ namespace Microsoft.WinGet.Client.Commands { using System.Management.Automation; using Microsoft.Management.Deployment; - using Microsoft.WinGet.Client.Helpers; + using Microsoft.WinGet.Client.Common; /// /// This commands updates a package from the pipeline or from the local system. @@ -35,19 +35,17 @@ protected override void ProcessRecord() base.ProcessRecord(); this.GetPackageAndExecute(CompositeSearchBehavior.LocalCatalogs, (package, version) => { - var options = this.GetInstallOptions(version); - var results = this.UpgradePackage(package, options); - this.WriteObject(results); + InstallOptions options = this.GetInstallOptions(version); + InstallResult result = this.UpgradePackage(package, options); + this.WriteObject(result); }); } /// protected override InstallOptions GetInstallOptions(PackageVersionId version) { - var options = base.GetInstallOptions(version); - + InstallOptions options = base.GetInstallOptions(version); options.AllowUpgradeToUnknownVersion = this.IncludeUnknown.ToBool(); - return options; } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseClientCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Common/BaseClientCommand.cs similarity index 57% rename from src/PowerShell/Microsoft.WinGet.Client/Commands/BaseClientCommand.cs rename to src/PowerShell/Microsoft.WinGet.Client/Common/BaseClientCommand.cs index 4fd6204c50..798e0ef185 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseClientCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Common/BaseClientCommand.cs @@ -1,90 +1,66 @@ -// ----------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. Licensed under the MIT License. -// -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ - using System; - using System.Collections.Generic; - using System.Management.Automation; - using System.Runtime.InteropServices; - using System.Security.Principal; - using Microsoft.Management.Deployment; - using Microsoft.WinGet.Client.Factories; - using Microsoft.WinGet.Client.Helpers; - - /// - /// This is the base class for all commands in this module. - /// - public class BaseClientCommand : PSCmdlet - { - /// - /// Initializes a new instance of the class. - /// - public BaseClientCommand() - : base() - { - var admin = CheckIfAdministrator(); - if (admin) - { - throw new Exception(Constants.ResourceManager.GetString("ExceptionMessages_NoAdmin")); - } - } - - /// - /// Gets the instance of the class. - /// - protected static Lazy ComObjectFactory { get; } = new Lazy(); - - /// - /// Gets the instance of the class. - /// - protected static Lazy PackageManager { get; } = new Lazy(() => ComObjectFactory.Value.CreatePackageManager()); +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- -#pragma warning disable IDE0051 // Remove unused private members - private static bool InitializedUndockedRegFreeWinRT { get; set; } = InitializeUndockedRegFreeWinRT(); -#pragma warning restore IDE0051 // Remove unused private members +namespace Microsoft.WinGet.Client.Common +{ + using System; + using System.Collections.Generic; + using System.Management.Automation; + using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Factories; - /// - /// Retrieves the specified source or all sources if is null. - /// - /// A list of instances. - /// The name of the source to retrieve. If null, then all sources are returned. - /// The source does not exist. - protected static IReadOnlyList GetPackageCatalogReferences(string source) - { - if (source is null) - { - return PackageManager.Value.GetPackageCatalogs(); - } - else - { - return new List() - { - PackageManager.Value.GetPackageCatalogByName(source) - ?? throw new ArgumentException(Constants.ResourceManager.GetString("ExceptionMessages_SourceNotFound")), - }; - } - } - - [DllImport("winrtact.dll", PreserveSig = false)] -#pragma warning disable SA1300 // Element should begin with upper-case letter - private static extern void winrtact_Initialize(); -#pragma warning restore SA1300 // Element should begin with upper-case letter - - private static bool InitializeUndockedRegFreeWinRT() - { - winrtact_Initialize(); - return true; - } - - private static bool CheckIfAdministrator() - { - WindowsIdentity identity = WindowsIdentity.GetCurrent(); - var principal = new WindowsPrincipal(identity); - return principal.IsInRole(WindowsBuiltInRole.Administrator); - } - } -} + /// + /// This is the base class for all of the commands in this module. + /// + public class BaseClientCommand : PSCmdlet + { + /// + /// Initializes a new instance of the class. + /// + public BaseClientCommand() + : base() + { + if (Utilities.ExecutingAsAdministrator) + { + throw new Exception(Utilities.ResourceManager.GetString("ExceptionAdministratorDisabled")); + } + } + + /// + /// Gets the instance of the class. + /// + protected static Lazy ComObjectFactory { get; } = new (); + + /// + /// Gets the instance of the class. + /// + protected static Lazy PackageManager { get; } = new (() => ComObjectFactory.Value.CreatePackageManager()); + + /// + /// Retrieves the specified source or all sources if is null. + /// + /// A list of instances. + /// The name of the source to retrieve. If null, then all sources are returned. + /// The source does not exist. + protected static IReadOnlyList GetPackageCatalogReferences(string source) + { + if (source is null) + { + return PackageManager.Value.GetPackageCatalogs(); + } + else + { + return new List() + { + PackageManager.Value.GetPackageCatalogByName(source) + ?? throw new ArgumentException(string.Format( + Utilities.ResourceManager.GetString("ArgumentExceptionInvalidSource"), + source)), + }; + } + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Common/BaseFinderCommand.cs similarity index 82% rename from src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs rename to src/PowerShell/Microsoft.WinGet.Client/Common/BaseFinderCommand.cs index 39bcc3cc15..94721f14f8 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Common/BaseFinderCommand.cs @@ -1,208 +1,212 @@ -// ----------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. Licensed under the MIT License. -// -// ----------------------------------------------------------------------------- - -namespace Microsoft.WinGet.Client.Commands -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Management.Automation; - using System.Reflection; - using Microsoft.Management.Deployment; - using Microsoft.WinGet.Client.Attributes; - using Microsoft.WinGet.Client.Errors; - using Microsoft.WinGet.Client.Helpers; - - /// - /// This is the base class for all commands that might need to search for packages. - /// - public class BaseFinderCommand : BaseClientCommand - { - /// - /// Gets or sets the field that is matched against the identifier of a package. - /// - [Filter(Field = PackageMatchField.Id)] - [Parameter( - ParameterSetName = Constants.FoundSet, - ValueFromPipelineByPropertyName = true)] - public string Id { get; set; } - - /// - /// Gets or sets the field that is matched against the name of a package. - /// - [Filter(Field = PackageMatchField.Name)] - [Parameter( - ParameterSetName = Constants.FoundSet, - ValueFromPipelineByPropertyName = true)] - public string Name { get; set; } - - /// - /// Gets or sets the field that is matched against the name of a package. - /// - [Filter(Field = PackageMatchField.Moniker)] - [Parameter( - ParameterSetName = Constants.FoundSet, - ValueFromPipelineByPropertyName = true)] - public string Moniker { get; set; } - - /// - /// Gets or sets the name of the source to search for packages. If null, then all sources are searched. - /// - [Parameter( - ParameterSetName = Constants.FoundSet, - ValueFromPipelineByPropertyName = true)] - public string Source { get; set; } - - /// - /// Gets or sets the strings that match against every field of a package. - /// - [Parameter( - ParameterSetName = Constants.FoundSet, - Position = 0, - ValueFromPipelineByPropertyName = true, - ValueFromRemainingArguments = true)] - public string[] Query { get; set; } - - /// - /// Gets or sets a value indicating whether to match exactly against package fields. - /// - [Parameter( - ParameterSetName = Constants.FoundSet, - ValueFromPipelineByPropertyName = true)] - public SwitchParameter Exact { get; set; } - - private string QueryAsJoinedString - { - get - { - return (this.Query is null) - ? null - : string.Join(" ", this.Query); - } - } - - /// - /// Returns a based on a parameter. - /// - /// A value. - protected virtual PackageFieldMatchOption GetExactAsMatchOption() - { - return this.Exact.ToBool() - ? PackageFieldMatchOption.Equals - : PackageFieldMatchOption.ContainsCaseInsensitive; - } - - /// - /// Searches for packages based on the configured parameters. - /// - /// The value. - /// The limit on the number of matches returned. - /// A list of objects. - protected IReadOnlyList FindPackages( - CompositeSearchBehavior behavior, - uint limit) - { - var catalog = this.GetPackageCatalog(behavior); - var options = this.GetFindPackagesOptions(limit); - return GetMatchResults(catalog, options); - } - - private static void SetQueryInFindPackagesOptions( - ref FindPackagesOptions options, - PackageFieldMatchOption match, - string value) - { - var selector = ComObjectFactory.Value.CreatePackageMatchFilter(); - selector.Field = PackageMatchField.CatalogDefault; - selector.Value = value ?? string.Empty; - selector.Option = match; - options.Selectors.Add(selector); - } - - private static void AddFilterToFindPackagesOptionsIfNotNull( - ref FindPackagesOptions options, - PackageMatchField field, - PackageFieldMatchOption match, - string value) - { - if (value != null) - { - var filter = ComObjectFactory.Value.CreatePackageMatchFilter(); - filter.Field = field; - filter.Value = value; - filter.Option = match; - options.Filters.Add(filter); - } - } - - private static IReadOnlyList GetMatchResults( - PackageCatalog catalog, - FindPackagesOptions options) - { - var result = catalog.FindPackages(options); - if (result.Status != FindPackagesResultStatus.Ok) - { - throw new FindPackagesException(result.Status); - } - - return result.Matches; - } - - private PackageCatalog GetPackageCatalog(CompositeSearchBehavior behavior) - { - var reference = this.GetPackageCatalogReference(behavior); - var result = reference.Connect(); - if (result.Status != ConnectResultStatus.Ok) - { - throw new RuntimeException(Constants.ResourceManager.GetString("ExceptionMessages_CatalogError")); - } - - return result.PackageCatalog; - } - - private PackageCatalogReference GetPackageCatalogReference(CompositeSearchBehavior behavior) - { - var options = ComObjectFactory.Value.CreateCreateCompositePackageCatalogOptions(); - var references = GetPackageCatalogReferences(this.Source); - for (var i = 0; i < references.Count; i++) - { - options.Catalogs.Add(references[i]); - } - - options.CompositeSearchBehavior = behavior; - return PackageManager.Value.CreateCompositePackageCatalog(options); - } - - private FindPackagesOptions GetFindPackagesOptions(uint limit) - { - var options = ComObjectFactory.Value.CreateFindPackagesOptions(); - SetQueryInFindPackagesOptions(ref options, this.GetExactAsMatchOption(), this.QueryAsJoinedString); - this.AddAttributedFiltersToFindPackagesOptions(ref options, this.GetExactAsMatchOption()); - options.ResultLimit = limit; - return options; - } - - private void AddAttributedFiltersToFindPackagesOptions( - ref FindPackagesOptions options, - PackageFieldMatchOption match) - { - var properties = this - .GetType() - .GetProperties() - .Where(property => Attribute.IsDefined(property, typeof(FilterAttribute))); - - foreach (var info in properties) - { - if (info.GetCustomAttribute(typeof(FilterAttribute), true) is FilterAttribute attribute) - { - PackageMatchField field = attribute.Field; - string value = info.GetValue(this, null) as string; - AddFilterToFindPackagesOptionsIfNotNull(ref options, field, match, value); - } - } - } - } -} +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Common +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using System.Reflection; + using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Attributes; + using Microsoft.WinGet.Client.Errors; + + /// + /// This is the base class for all commands that might need to search for a package. It contains an initial + /// set of parameters that corresponds to the intersection of i.e., the "install" and "search" commands. + /// + public class BaseFinderCommand : BaseClientCommand + { + /// + /// Gets or sets the field that is matched against the identifier of a package. + /// + [Filter(Field = PackageMatchField.Id)] + [Parameter( + ParameterSetName = Constants.FoundSet, + ValueFromPipelineByPropertyName = true)] + public string Id { get; set; } + + /// + /// Gets or sets the field that is matched against the name of a package. + /// + [Filter(Field = PackageMatchField.Name)] + [Parameter( + ParameterSetName = Constants.FoundSet, + ValueFromPipelineByPropertyName = true)] + public string Name { get; set; } + + /// + /// Gets or sets the field that is matched against the name of a package. + /// + [Filter(Field = PackageMatchField.Moniker)] + [Parameter( + ParameterSetName = Constants.FoundSet, + ValueFromPipelineByPropertyName = true)] + public string Moniker { get; set; } + + /// + /// Gets or sets the name of the source to search for packages. If null, then all sources are searched. + /// + [Parameter( + ParameterSetName = Constants.FoundSet, + ValueFromPipelineByPropertyName = true)] + public string Source { get; set; } + + /// + /// Gets or sets the strings that match against every field of a package. + /// + [Parameter( + ParameterSetName = Constants.FoundSet, + Position = 0, + ValueFromPipelineByPropertyName = true, + ValueFromRemainingArguments = true)] + public string[] Query { get; set; } + + /// + /// Gets or sets a value indicating whether to match exactly against package fields. + /// + [Parameter( + ParameterSetName = Constants.FoundSet, + ValueFromPipelineByPropertyName = true)] + public SwitchParameter Exact { get; set; } + + private string QueryAsJoinedString + { + get + { + return (this.Query is null) + ? null + : string.Join(" ", this.Query); + } + } + + /// + /// Returns a based on a parameter. + /// + /// A value. + protected virtual PackageFieldMatchOption GetExactAsMatchOption() + { + return this.Exact.ToBool() + ? PackageFieldMatchOption.Equals + : PackageFieldMatchOption.ContainsCaseInsensitive; + } + + /// + /// Searches for packages based on the configured parameters. + /// + /// The value. + /// The limit on the number of matches returned. + /// A list of objects. + protected IReadOnlyList FindPackages( + CompositeSearchBehavior behavior, + uint limit) + { + PackageCatalog catalog = this.GetPackageCatalog(behavior); + FindPackagesOptions options = this.GetFindPackagesOptions(limit); + return GetMatchResults(catalog, options); + } + + private static void SetQueryInFindPackagesOptions( + ref FindPackagesOptions options, + PackageFieldMatchOption match, + string value) + { + var selector = ComObjectFactory.Value.CreatePackageMatchFilter(); + selector.Field = PackageMatchField.CatalogDefault; + selector.Value = value ?? string.Empty; + selector.Option = match; + options.Selectors.Add(selector); + } + + private static void AddFilterToFindPackagesOptionsIfNotNull( + ref FindPackagesOptions options, + PackageMatchField field, + PackageFieldMatchOption match, + string value) + { + if (value != null) + { + var filter = ComObjectFactory.Value.CreatePackageMatchFilter(); + filter.Field = field; + filter.Value = value; + filter.Option = match; + options.Filters.Add(filter); + } + } + + private static IReadOnlyList GetMatchResults( + PackageCatalog catalog, + FindPackagesOptions options) + { + FindPackagesResult result = catalog.FindPackages(options); + if (result.Status == FindPackagesResultStatus.Ok) + { + return result.Matches; + } + else + { + throw new FindPackagesException(result.Status); + } + } + + private PackageCatalog GetPackageCatalog(CompositeSearchBehavior behavior) + { + PackageCatalogReference reference = this.GetPackageCatalogReference(behavior); + ConnectResult result = reference.Connect(); + if (result.Status == ConnectResultStatus.Ok) + { + return result.PackageCatalog; + } + else + { + throw new RuntimeException(Utilities.ResourceManager.GetString("RuntimeExceptionCatalogError")); + } + } + + private PackageCatalogReference GetPackageCatalogReference(CompositeSearchBehavior behavior) + { + CreateCompositePackageCatalogOptions options = ComObjectFactory.Value.CreateCreateCompositePackageCatalogOptions(); + IReadOnlyList references = GetPackageCatalogReferences(this.Source); + for (var i = 0; i < references.Count; i++) + { + options.Catalogs.Add(references[i]); + } + + options.CompositeSearchBehavior = behavior; + return PackageManager.Value.CreateCompositePackageCatalog(options); + } + + private FindPackagesOptions GetFindPackagesOptions(uint limit) + { + var options = ComObjectFactory.Value.CreateFindPackagesOptions(); + SetQueryInFindPackagesOptions(ref options, this.GetExactAsMatchOption(), this.QueryAsJoinedString); + this.AddAttributedFiltersToFindPackagesOptions(ref options, this.GetExactAsMatchOption()); + options.ResultLimit = limit; + return options; + } + + private void AddAttributedFiltersToFindPackagesOptions( + ref FindPackagesOptions options, + PackageFieldMatchOption match) + { + IEnumerable properties = this + .GetType() + .GetProperties() + .Where(property => Attribute.IsDefined(property, typeof(FilterAttribute))); + + foreach (PropertyInfo info in properties) + { + if (info.GetCustomAttribute(typeof(FilterAttribute), true) is FilterAttribute attribute) + { + PackageMatchField field = attribute.Field; + string value = info.GetValue(this, null) as string; + AddFilterToFindPackagesOptionsIfNotNull(ref options, field, match, value); + } + } + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderExtendedCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Common/BaseFinderExtendedCommand.cs similarity index 88% rename from src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderExtendedCommand.cs rename to src/PowerShell/Microsoft.WinGet.Client/Common/BaseFinderExtendedCommand.cs index f8b74f0934..3d8a6008a2 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseFinderExtendedCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Common/BaseFinderExtendedCommand.cs @@ -4,16 +4,17 @@ // // ----------------------------------------------------------------------------- -namespace Microsoft.WinGet.Client.Commands +namespace Microsoft.WinGet.Client.Common { using System.Collections.Generic; using System.Management.Automation; using Microsoft.Management.Deployment; using Microsoft.WinGet.Client.Attributes; - using Microsoft.WinGet.Client.Helpers; /// - /// This is the base class for some of the commands that search for packages. + /// This is the base class for the commands whose sole purpose is to filter a list of packages i.e., + /// the "search" and "list" commands. This class contains an extended set of parameters suited for + /// that purpose. /// public class BaseFinderExtendedCommand : BaseFinderCommand { diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseInstallCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Common/BaseInstallCommand.cs similarity index 86% rename from src/PowerShell/Microsoft.WinGet.Client/Commands/BaseInstallCommand.cs rename to src/PowerShell/Microsoft.WinGet.Client/Common/BaseInstallCommand.cs index dc2257fff4..35faa7f05b 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseInstallCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Common/BaseInstallCommand.cs @@ -8,16 +8,18 @@ using Windows.Foundation; #pragma warning restore SA1200 // Using directives should be placed correctly -namespace Microsoft.WinGet.Client.Commands +namespace Microsoft.WinGet.Client.Common { using System.IO; using System.Management.Automation; using Microsoft.Management.Deployment; + using Microsoft.WinGet.Client.Helpers; /// - /// This is the base class for the install and upgrade commands. + /// This is the base class for all commands that parse a result + /// from the provided parameters i.e., the "install" and "upgrade" commands. /// - public class BaseInstallCommand : BaseLifecycleCommand + public class BaseInstallCommand : BasePackageCommand { private string location; @@ -42,11 +44,9 @@ public string Location get => this.location; set { - string prefix = Path.IsPathRooted(value) - ? string.Empty - : this.SessionState.Path.CurrentFileSystemLocation + @"\"; - - this.location = prefix + value; + this.location = Path.IsPathRooted(value) + ? value + : this.SessionState.Path.CurrentFileSystemLocation + @"\" + value; } } @@ -69,11 +69,9 @@ public string Location /// An instance. protected virtual InstallOptions GetInstallOptions(PackageVersionId version) { - var options = ComObjectFactory.Value.CreateInstallOptions(); - + InstallOptions options = ComObjectFactory.Value.CreateInstallOptions(); options.AllowHashMismatch = this.Force.ToBool(); options.PackageInstallMode = this.Mode; - if (version != null) { options.PackageVersionId = version; @@ -112,11 +110,10 @@ protected InstallResult RegisterCallbacksAndWait( IAsyncOperationWithProgress operation, string activity) { - var adapter = new Helpers.WriteProgressAdapter(this); - + WriteProgressAdapter adapter = new (this); operation.Progress = (context, progress) => { - var record = new ProgressRecord(1, activity, progress.State.ToString()) + ProgressRecord record = new (1, activity, progress.State.ToString()) { RecordType = ProgressRecordType.Processing, }; @@ -133,23 +130,18 @@ protected InstallResult RegisterCallbacksAndWait( adapter.WriteProgress(record); }; - operation.Completed = (context, status) => { - var record = new ProgressRecord(1, activity, status.ToString()) + adapter.WriteProgress(new ProgressRecord(1, activity, status.ToString()) { RecordType = ProgressRecordType.Completed, - }; - - adapter.WriteProgress(record); + }); adapter.Completed = true; }; - System.Console.CancelKeyPress += (sender, e) => { operation.Cancel(); }; - adapter.Wait(); return operation.GetResults(); } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseLifecycleCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Common/BasePackageCommand.cs similarity index 66% rename from src/PowerShell/Microsoft.WinGet.Client/Commands/BaseLifecycleCommand.cs rename to src/PowerShell/Microsoft.WinGet.Client/Common/BasePackageCommand.cs index eef24d24ea..5305f381ef 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/BaseLifecycleCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Common/BasePackageCommand.cs @@ -1,28 +1,32 @@ // ----------------------------------------------------------------------------- -// +// // Copyright (c) Microsoft Corporation. Licensed under the MIT License. // // ----------------------------------------------------------------------------- -namespace Microsoft.WinGet.Client.Commands +namespace Microsoft.WinGet.Client.Common { using System; + using System.Collections.Generic; using System.IO; using System.Management.Automation; using Microsoft.Management.Deployment; using Microsoft.WinGet.Client.Errors; - using Microsoft.WinGet.Client.Helpers; /// - /// This is the base class for commands which operate on a specific package version. + /// This is the base class for commands which operate on a specific package & version i.e., + /// the "install", "uninstall", and "upgrade" commands. /// - public class BaseLifecycleCommand : BaseFinderCommand + public class BasePackageCommand : BaseFinderCommand { private string log; /// /// Gets or sets the package to directly install. /// + /// + /// Must match the name of the field on the class. + /// [Alias("InputObject")] [ValidateNotNull] [Parameter( @@ -47,11 +51,9 @@ public string Log get => this.log; set { - string prefix = Path.IsPathRooted(value) - ? string.Empty - : this.SessionState.Path.CurrentFileSystemLocation + @"\"; - - this.log = prefix + value; + this.log = Path.IsPathRooted(value) + ? value + : this.SessionState.Path.CurrentFileSystemLocation + @"\" + value; } } @@ -72,10 +74,9 @@ protected void GetPackageAndExecute( CompositeSearchBehavior behavior, Action callback) { - var package = this.GetCatalogPackage(behavior); - var version = this.GetPackageVersionId(package); - var confirm = this.ConfirmOperation(package, version); - if (confirm) + CatalogPackage package = this.GetCatalogPackage(behavior); + PackageVersionId version = this.GetPackageVersionId(package); + if (this.ShouldProcess(package.ToString(version))) { callback(package, version); } @@ -85,21 +86,25 @@ private CatalogPackage GetCatalogPackage(CompositeSearchBehavior behavior) { if (this.ParameterSetName == Constants.GivenSet) { + // The package was already provided via a parameter or the pipeline. return this.CatalogPackage; } else { - var results = this.FindPackages(behavior, 0); + IReadOnlyList results = this.FindPackages(behavior, 0); if (results.Count == 1) { + // Exactly one package matched, so we can just return it. return results[0].CatalogPackage; } else if (results.Count == 0) { - throw new RuntimeException(Constants.ResourceManager.GetString("ExceptionMessages_NoPackagesFound")); + // No packages matched, we need to throw an error. + throw new RuntimeException(Utilities.ResourceManager.GetString("RuntimeExceptionNoPackagesFound")); } else { + // Too many packages matched! The user needs to refine their input. throw new VagueCriteriaException(results); } } @@ -109,28 +114,20 @@ private PackageVersionId GetPackageVersionId(CatalogPackage package) { if (this.Version != null) { - var versions = package.AvailableVersions; - - for (var i = 0; i < versions.Count; i++) + for (var i = 0; i < package.AvailableVersions.Count; i++) { - if (versions[i].Version.CompareTo(this.Version) == 0) + if (package.AvailableVersions[i].Version.CompareTo(this.Version) == 0) { - return versions[i]; + return package.AvailableVersions[i]; } } - throw new ArgumentException(Constants.ResourceManager.GetString("ExceptionMessages_VersionNotFound")); + throw new ArgumentException(Utilities.ResourceManager.GetString("RuntimeExceptionInvalidVersion")); } else { return null; } } - - private bool ConfirmOperation(CatalogPackage package, PackageVersionId version) - { - string target = package.ToString(version); - return this.ShouldProcess(target); - } } } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Helpers/Constants.cs b/src/PowerShell/Microsoft.WinGet.Client/Common/Constants.cs similarity index 74% rename from src/PowerShell/Microsoft.WinGet.Client/Helpers/Constants.cs rename to src/PowerShell/Microsoft.WinGet.Client/Common/Constants.cs index bb98e7452b..0174f7e97f 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Helpers/Constants.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Common/Constants.cs @@ -4,10 +4,8 @@ // // ----------------------------------------------------------------------------- -namespace Microsoft.WinGet.Client.Helpers +namespace Microsoft.WinGet.Client.Common { - using System.Reflection; - using System.Resources; using Microsoft.Management.Deployment; /// @@ -36,12 +34,13 @@ public static class Constants public const uint CountUpperBound = 1000; /// - /// This is the name of the parameter set for when a package was supplied. + /// This parameter set indicates that a package was provided via a parameter or the pipeline and it can be acted on directly. /// public const string GivenSet = "GivenSet"; /// - /// This is the name of the parameter set for when a package was not supplied. + /// This parameter set indicates that a package was not provided via a parameter or the pipeline and it + /// needs to be found by searching a package source. /// public const string FoundSet = "FoundSet"; @@ -49,17 +48,5 @@ public static class Constants /// This is the path provided to the resource manager to access localized strings. /// public const string ResourcesPath = "Microsoft.WinGet.Client.Properties.Resources"; - - /// - /// Gets the instance for the executing assembly. - /// - public static ResourceManager ResourceManager - { - get - { - Assembly assembly = Assembly.GetExecutingAssembly(); - return new ResourceManager(ResourcesPath, assembly); - } - } } } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Common/Utilities.cs b/src/PowerShell/Microsoft.WinGet.Client/Common/Utilities.cs new file mode 100644 index 0000000000..d0b6f5b297 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Common/Utilities.cs @@ -0,0 +1,43 @@ +// ----------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. Licensed under the MIT License. +// +// ----------------------------------------------------------------------------- + +namespace Microsoft.WinGet.Client.Common +{ + using System.Reflection; + using System.Resources; + using System.Security.Principal; + + /// + /// This class contains various helper methods for this project. + /// + public static class Utilities + { + /// + /// Gets the instance for the executing assembly. + /// + public static ResourceManager ResourceManager + { + get + { + Assembly assembly = Assembly.GetExecutingAssembly(); + return new ResourceManager(Constants.ResourcesPath, assembly); + } + } + + /// + /// Gets a value indicating whether the current assembly is executing in an administrative context. + /// + public static bool ExecutingAsAdministrator + { + get + { + WindowsIdentity identity = WindowsIdentity.GetCurrent(); + WindowsPrincipal principal = new (identity); + return principal.IsInRole(WindowsBuiltInRole.Administrator); + } + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Errors/FindPackagesException.cs b/src/PowerShell/Microsoft.WinGet.Client/Errors/FindPackagesException.cs index bdcd2e392f..ca417e0c2f 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Errors/FindPackagesException.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Errors/FindPackagesException.cs @@ -8,7 +8,7 @@ namespace Microsoft.WinGet.Client.Errors { using System; using Microsoft.Management.Deployment; - using Microsoft.WinGet.Client.Helpers; + using Microsoft.WinGet.Client.Common; /// /// Raised when there is an error searching for packages. @@ -21,7 +21,9 @@ public class FindPackagesException : Exception /// /// A value. public FindPackagesException(FindPackagesResultStatus status) - : base(Constants.ResourceManager.GetString("ExceptionMessages_SearchFailure")) + : base(string.Format( + Utilities.ResourceManager.GetString("FindPackagesExceptionMessage"), + status.ToString())) { this.Status = status; } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Errors/VagueCriteriaException.cs b/src/PowerShell/Microsoft.WinGet.Client/Errors/VagueCriteriaException.cs index 1576573c49..b6a1e8f72d 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Errors/VagueCriteriaException.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Errors/VagueCriteriaException.cs @@ -9,7 +9,7 @@ namespace Microsoft.WinGet.Client.Errors using System; using System.Collections.Generic; using Microsoft.Management.Deployment; - using Microsoft.WinGet.Client.Helpers; + using Microsoft.WinGet.Client.Common; /// /// Raised when search criteria for installing or updating a package is too vague. @@ -23,10 +23,10 @@ public class VagueCriteriaException : Exception /// The list of conflicting packages of length at least two. public VagueCriteriaException(IReadOnlyList results) : base(string.Format( - Constants.ResourceManager.GetString("ExceptionMessages_VagueSearch"), - (results.Count > 0) ? results[0].CatalogPackage.ToString(null) : null, - (results.Count > 1) ? results[1].CatalogPackage.ToString(null) : null, - Math.Max(results.Count, 2) - 2)) + Utilities.ResourceManager.GetString("VagueCriteriaExceptionMessage"), + results[0].CatalogPackage.ToString(null), + results[1].CatalogPackage.ToString(null), + results.Count - 2)) { this.MatchResults = results; } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Helpers/CatalogPackageExtensions.cs b/src/PowerShell/Microsoft.WinGet.Client/Helpers/CatalogPackageExtensions.cs index 4bb74fed0a..b21090451e 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Helpers/CatalogPackageExtensions.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Helpers/CatalogPackageExtensions.cs @@ -12,7 +12,7 @@ namespace Microsoft.Management.Deployment public static class CatalogPackageExtensions { /// - /// Converts a to a string with the specified version. + /// Converts a to a string previewing the specified version. /// /// A instance. /// A instance. If null, the latest available version is used. @@ -26,11 +26,11 @@ public static string ToString( string versionString = (version is null) ? package.AvailableVersions[0].Version : version.Version; - return $"{package.Name} [{package.Id}] Version {versionString}"; } else { + // There were no available versions! return $"{package.Name} [{package.Id}]"; } } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Factories/ComObjectFactory.cs b/src/PowerShell/Microsoft.WinGet.Client/Helpers/ComObjectFactory.cs similarity index 86% rename from src/PowerShell/Microsoft.WinGet.Client/Factories/ComObjectFactory.cs rename to src/PowerShell/Microsoft.WinGet.Client/Helpers/ComObjectFactory.cs index e2332b7745..cd4a907d50 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Factories/ComObjectFactory.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Helpers/ComObjectFactory.cs @@ -19,19 +19,22 @@ namespace Microsoft.WinGet.Client.Factories /// public class ComObjectFactory { - private static readonly Guid PackageManagerCLSID = Guid.Parse("C53A4F16-787E-42A4-B304-29EFFB4BF597"); - private static readonly Guid FindPackagesOptionsCLSID = Guid.Parse("572DED96-9C60-4526-8F92-EE7D91D38C1A"); - private static readonly Guid CreateCompositePackageCatalogOptionsCLSID = Guid.Parse("526534B8-7E46-47C8-8416-B1685C327D37"); - private static readonly Guid InstallOptionsCLSID = Guid.Parse("1095F097-EB96-453B-B4E6-1613637F3B14"); - private static readonly Guid UninstallOptionsCLSID = Guid.Parse("E1D9A11E-9F85-4D87-9C17-2B93143ADB8D"); - private static readonly Guid PackageMatchFilterCLSID = Guid.Parse("D02C9DAF-99DC-429C-B503-4E504E4AB000"); +#if USE_TEST_CLSIDS +#else + private static readonly Guid PackageManagerClsid = Guid.Parse("C53A4F16-787E-42A4-B304-29EFFB4BF597"); + private static readonly Guid FindPackagesOptionsClsid = Guid.Parse("572DED96-9C60-4526-8F92-EE7D91D38C1A"); + private static readonly Guid CreateCompositePackageCatalogOptionsClsid = Guid.Parse("526534B8-7E46-47C8-8416-B1685C327D37"); + private static readonly Guid InstallOptionsClsid = Guid.Parse("1095F097-EB96-453B-B4E6-1613637F3B14"); + private static readonly Guid UninstallOptionsClsid = Guid.Parse("E1D9A11E-9F85-4D87-9C17-2B93143ADB8D"); + private static readonly Guid PackageMatchFilterClsid = Guid.Parse("D02C9DAF-99DC-429C-B503-4E504E4AB000"); +#endif - private static readonly Type PackageManagerType = Type.GetTypeFromCLSID(PackageManagerCLSID); - private static readonly Type FindPackagesOptionsType = Type.GetTypeFromCLSID(FindPackagesOptionsCLSID); - private static readonly Type CreateCompositePackageCatalogOptionsType = Type.GetTypeFromCLSID(CreateCompositePackageCatalogOptionsCLSID); - private static readonly Type InstallOptionsType = Type.GetTypeFromCLSID(InstallOptionsCLSID); - private static readonly Type UninstallOptionsType = Type.GetTypeFromCLSID(UninstallOptionsCLSID); - private static readonly Type PackageMatchFilterType = Type.GetTypeFromCLSID(PackageMatchFilterCLSID); + private static readonly Type PackageManagerType = Type.GetTypeFromCLSID(PackageManagerClsid); + private static readonly Type FindPackagesOptionsType = Type.GetTypeFromCLSID(FindPackagesOptionsClsid); + private static readonly Type CreateCompositePackageCatalogOptionsType = Type.GetTypeFromCLSID(CreateCompositePackageCatalogOptionsClsid); + private static readonly Type InstallOptionsType = Type.GetTypeFromCLSID(InstallOptionsClsid); + private static readonly Type UninstallOptionsType = Type.GetTypeFromCLSID(UninstallOptionsClsid); + private static readonly Type PackageMatchFilterType = Type.GetTypeFromCLSID(PackageMatchFilterClsid); /// /// Creates an instance of the class. diff --git a/src/PowerShell/Microsoft.WinGet.Client/Attributes/FilterAttribute.cs b/src/PowerShell/Microsoft.WinGet.Client/Helpers/FilterAttribute.cs similarity index 73% rename from src/PowerShell/Microsoft.WinGet.Client/Attributes/FilterAttribute.cs rename to src/PowerShell/Microsoft.WinGet.Client/Helpers/FilterAttribute.cs index 5b283705a4..7700b71cc3 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Attributes/FilterAttribute.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Helpers/FilterAttribute.cs @@ -10,7 +10,9 @@ namespace Microsoft.WinGet.Client.Attributes using Microsoft.Management.Deployment; /// - /// Marking a property with this attribute causes it to be added to the filters list when searching for packages. + /// A is constructed by introspecting on the inheritance tree and + /// looking for parameters that are marked with this attribute. Properties that are marked with this + /// attribute are added to the object. /// [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class FilterAttribute : Attribute diff --git a/src/PowerShell/Microsoft.WinGet.Client/Helpers/WriteProgressAdapter.cs b/src/PowerShell/Microsoft.WinGet.Client/Helpers/WriteProgressAdapter.cs index a23afd1e4b..b03ba97576 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Helpers/WriteProgressAdapter.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Helpers/WriteProgressAdapter.cs @@ -6,7 +6,6 @@ namespace Microsoft.WinGet.Client.Helpers { - using System; using System.Collections.Generic; using System.Management.Automation; using System.Threading; @@ -16,8 +15,8 @@ namespace Microsoft.WinGet.Client.Helpers /// public class WriteProgressAdapter { - private readonly AutoResetEvent resetEvent = new AutoResetEvent(false); - private readonly Queue records = new Queue(); + private readonly AutoResetEvent resetEvent = new (false); + private readonly Queue records = new (); private readonly Cmdlet cmdlet; private volatile bool completed = false; @@ -84,8 +83,7 @@ private void Flush() { while (this.records.Count > 0) { - ProgressRecord record = this.records.Dequeue(); - this.cmdlet.WriteProgress(record); + this.cmdlet.WriteProgress(this.records.Dequeue()); } } } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj index e8cb8a48ce..b50d6d083f 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj @@ -1,63 +1,70 @@ - - - - net5.0-windows10.0.22000.0;net461 - ARM64;x64;x86 - true - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - Content - Always - - - Content - Always - - - - - - - - - - - - - - True - True - Resources.resx - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - Microsoft.Management.Deployment - 10.0.22000.0 - - 10.0.17763.0 - - + + + + 10.0.22000.0 + net5.0-windows$(TargetWindowsVersion) + net461 + + + + true + 9 + x64;x86 + $(CoreFramework);$(DesktopFramework) + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + Content + Always + + + Content + Always + + + + + + + + + + + + + + True + True + Resource.resx + + + + + + ResXFileCodeGenerator + Resource.Designer.cs + + + + + Microsoft.Management.Deployment + $(TargetWindowsVersion) + + 10.0.17763.0 + + \ No newline at end of file diff --git a/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.Designer.cs b/src/PowerShell/Microsoft.WinGet.Client/Properties/Resource.Designer.cs similarity index 63% rename from src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.Designer.cs rename to src/PowerShell/Microsoft.WinGet.Client/Properties/Resource.Designer.cs index d924c28c6d..f22f568e26 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.Designer.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Properties/Resource.Designer.cs @@ -22,14 +22,14 @@ namespace Microsoft.WinGet.Client.Properties { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { + internal class Resource { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { + internal Resource() { } /// @@ -39,7 +39,7 @@ internal Resources() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.WinGet.Client.Properties.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.WinGet.Client.Properties.Resource", typeof(Resource).Assembly); resourceMan = temp; } return resourceMan; @@ -61,65 +61,65 @@ internal Resources() { } /// - /// Looks up a localized string similar to There was an error connecting to the source.. + /// Looks up a localized string similar to No source matches the given value: {0}. /// - internal static string ExceptionMessages_CatalogError { + internal static string ArgumentExceptionInvalidSource { get { - return ResourceManager.GetString("ExceptionMessages_CatalogError", resourceCulture); + return ResourceManager.GetString("ArgumentExceptionInvalidSource", resourceCulture); } } /// - /// Looks up a localized string similar to This cmdlet is currently not available in an administrator context.. + /// Looks up a localized string similar to This cmdlet is currently disabled in an administrative context.. /// - internal static string ExceptionMessages_NoAdmin { + internal static string ExceptionAdministratorDisabled { get { - return ResourceManager.GetString("ExceptionMessages_NoAdmin", resourceCulture); + return ResourceManager.GetString("ExceptionAdministratorDisabled", resourceCulture); } } /// - /// Looks up a localized string similar to No packages matched the given input criteria.. + /// Looks up a localized string similar to An error occurred while searching for packages: {0}. /// - internal static string ExceptionMessages_NoPackagesFound { + internal static string FindPackagesExceptionMessage { get { - return ResourceManager.GetString("ExceptionMessages_NoPackagesFound", resourceCulture); + return ResourceManager.GetString("FindPackagesExceptionMessage", resourceCulture); } } /// - /// Looks up a localized string similar to There was an error searching for packages.. + /// Looks up a localized string similar to An error occurred while connecting to the catalog.. /// - internal static string ExceptionMessages_SearchFailure { + internal static string RuntimeExceptionCatalogError { get { - return ResourceManager.GetString("ExceptionMessages_SearchFailure", resourceCulture); + return ResourceManager.GetString("RuntimeExceptionCatalogError", resourceCulture); } } /// - /// Looks up a localized string similar to A source with the given name was not found.. + /// Looks up a localized string similar to No versions matched the given value: {0}. /// - internal static string ExceptionMessages_SourceNotFound { + internal static string RuntimeExceptionInvalidVersion { get { - return ResourceManager.GetString("ExceptionMessages_SourceNotFound", resourceCulture); + return ResourceManager.GetString("RuntimeExceptionInvalidVersion", resourceCulture); } } /// - /// Looks up a localized string similar to '{0}', '{1}', and {2} other package(s) matched the input criteria. Please refine the input.. + /// Looks up a localized string similar to No packages matched the given input criteria.. /// - internal static string ExceptionMessages_VagueSearch { + internal static string RuntimeExceptionNoPackagesFound { get { - return ResourceManager.GetString("ExceptionMessages_VagueSearch", resourceCulture); + return ResourceManager.GetString("RuntimeExceptionNoPackagesFound", resourceCulture); } } /// - /// Looks up a localized string similar to No version matched the given input criteria.. + /// Looks up a localized string similar to {0}, {1}, and {2} other packages matched the input criteria. Please refine the input.. /// - internal static string ExceptionMessages_VersionNotFound { + internal static string VagueCriteriaExceptionMessage { get { - return ResourceManager.GetString("ExceptionMessages_VersionNotFound", resourceCulture); + return ResourceManager.GetString("VagueCriteriaExceptionMessage", resourceCulture); } } } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.resx b/src/PowerShell/Microsoft.WinGet.Client/Properties/Resource.resx similarity index 79% rename from src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.resx rename to src/PowerShell/Microsoft.WinGet.Client/Properties/Resource.resx index bb24c59bd8..4aff5d015a 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.resx +++ b/src/PowerShell/Microsoft.WinGet.Client/Properties/Resource.resx @@ -1,141 +1,145 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - There was an error connecting to the source. - - - This cmdlet is currently not available in an administrator context. - - - No packages matched the given input criteria. - - - There was an error searching for packages. - - - A source with the given name was not found. - - - '{0}', '{1}', and {2} other package(s) matched the input criteria. Please refine the input. - - - No version matched the given input criteria. - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + No source matches the given value: {0} + {0} - The name of the source that was not found. + + + This cmdlet is currently disabled in an administrative context. + + + An error occurred while searching for packages: {0} + {0} - A string representation of the error status returned by the catalog. + + + An error occurred while connecting to the catalog. + + + No versions matched the given value: {0} + {0} - The version string provided by the user. + + + No packages matched the given input criteria. + + + {0}, {1}, and {2} other packages matched the input criteria. Please refine the input. + {0} - The first conflicting package as a string. {1} - The second conflicting package. {2} - The number of other packages that also matched the input criteria. + \ No newline at end of file From 1289fbba57144cb7c86f376930c23c19b2a1b013 Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Tue, 19 Jul 2022 21:51:30 -0700 Subject: [PATCH 14/21] Change build script to be pipeline friendly --- .../Microsoft.WinGet.Client/Build-Module.ps1 | 38 --- .../Copy-ModuleFiles.ps1 | 24 ++ .../Copy-PlatformBinaries.ps1 | 48 ++++ .../Microsoft.WinGet.Client.csproj | 1 + .../Microsoft.WinGet.Client.psd1 | 222 +++++++++--------- .../Microsoft.WinGet.Client/README.md | 25 -- 6 files changed, 182 insertions(+), 176 deletions(-) delete mode 100644 src/PowerShell/Microsoft.WinGet.Client/Build-Module.ps1 create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Copy-ModuleFiles.ps1 create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Copy-PlatformBinaries.ps1 delete mode 100644 src/PowerShell/Microsoft.WinGet.Client/README.md diff --git a/src/PowerShell/Microsoft.WinGet.Client/Build-Module.ps1 b/src/PowerShell/Microsoft.WinGet.Client/Build-Module.ps1 deleted file mode 100644 index 0409ab4282..0000000000 --- a/src/PowerShell/Microsoft.WinGet.Client/Build-Module.ps1 +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) Microsoft Corporation. Licensed under the MIT License. - -[CmdletBinding()] -param ( - [Parameter()] - $In = "$PSScriptRoot\bin", - - [Parameter()] - [string] - $Out = "$PSScriptRoot\build\bin", - - [Parameter()] - [string] - $Configuration = 'Release' -) - -$CoreFramework = 'net5.0-windows10.0.22000.0' -$DesktopFramework = 'net461' - -if (Test-Path $Out) { - Remove-Item $Out -Recurse -} - -Get-ChildItem $In -ErrorAction SilentlyContinue -Exclude 'Debug','Release' | ForEach-Object { - Write-Verbose ($_.FullName) - - $coreSrcPath = Join-Path (Join-Path $_.FullName $Configuration) $CoreFramework - $coreDstPath = Join-Path (Join-Path $Out $_.Name) 'Core' - $desktopSrcPath = Join-Path (Join-Path $_.FullName $Configuration) $DesktopFramework - $desktopDstPath = Join-Path (Join-Path $Out $_.Name) 'Desktop' - - Copy-Item $coreSrcPath -Destination $coreDstPath -Recurse -Force - Copy-Item $desktopSrcPath -Destination $desktopDstPath -Recurse -Force -} - -Copy-Item 'Format.ps1xml' -Destination $Out -Copy-Item 'Microsoft.WinGet.Client.psd1' -Destination $Out -Copy-Item 'Microsoft.WinGet.Client.psm1' -Destination $Out diff --git a/src/PowerShell/Microsoft.WinGet.Client/Copy-ModuleFiles.ps1 b/src/PowerShell/Microsoft.WinGet.Client/Copy-ModuleFiles.ps1 new file mode 100644 index 0000000000..6cdbb0d708 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Copy-ModuleFiles.ps1 @@ -0,0 +1,24 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +<# + .SYNOPSIS + Copies everything but the binary files to an output directory. + + .PARAMETER OutDir + The output directory where the module manifest will live. +#> + +[CmdletBinding()] +param ( + [Parameter(Mandatory)] + [string] + $OutDir +) + +New-Item $OutDir -ItemType Directory -Force -ErrorAction Stop +Copy-Item "$PSScriptRoot\Microsoft.WinGet.Client.psd1" $OutDir -Force -ErrorAction Stop +Copy-Item "$PSScriptRoot\Microsoft.WinGet.Client.psm1" $OutDir -Force -ErrorAction Stop +Copy-Item "$PSScriptRoot\Format.ps1xml" $OutDir -Force -ErrorAction Stop + +Write-Host 'Done!' -ForegroundColor Green diff --git a/src/PowerShell/Microsoft.WinGet.Client/Copy-PlatformBinaries.ps1 b/src/PowerShell/Microsoft.WinGet.Client/Copy-PlatformBinaries.ps1 new file mode 100644 index 0000000000..e52d290d92 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Copy-PlatformBinaries.ps1 @@ -0,0 +1,48 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +<# + .SYNOPSIS + Copies built binaries for a specific platform to an output directory. + + .PARAMETER Platform + The platform we are building for. + + .PARAMETER Configuration + The configuration we are building in. + + .PARAMETER OutDir + The base output directory where the module manifest will be. +#> + +[CmdletBinding()] +param ( + [Parameter(Mandatory)] + [string] + $Platform, + + [Parameter(Mandatory)] + [string] + $Configuration, + + [Parameter(Mandatory)] + [string] + $OutDir +) + +# src\x64\Release\Project\net461\Library.Desktop.dll +# src\x64\Release\Project\net5.0-windows10.0.22000.0\Library.Core.dll + +# build\Module\x64\Desktop\Library.Desktop.dll +# build\Module\x64\Core\Library.Core.dll + +$CoreFramework = 'net5.0-windows10.0.22000.0' +$CoreFolderName = 'Core' +$DesktopFramework = 'net461' +$DesktopFolderName = 'Desktop' +$ProjectName = 'Microsoft.WinGet.Client' + +Copy-Item "$PSScriptRoot\..\..\$Platform\$Configuration\$ProjectName\$CoreFramework" "$OutDir\$Platform\$CoreFolderName" -Force -Recurse -ErrorAction Stop +Copy-Item "$PSScriptRoot\..\..\$Platform\$Configuration\$ProjectName\$DesktopFramework" "$OutDir\$Platform\$DesktopFolderName" -Force -Recurse -ErrorAction Stop + +Write-Host 'Done!' -ForegroundColor Green diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj index b50d6d083f..764441be32 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj @@ -9,6 +9,7 @@ true 9 + $(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\ x64;x86 $(CoreFramework);$(DesktopFramework) diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 index b4151817eb..0d8d3ed09e 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 @@ -8,161 +8,157 @@ @{ - # Script module or binary module file associated with this manifest. - RootModule = 'Microsoft.WinGet.Client.psm1' +# Script module or binary module file associated with this manifest. +RootModule = 'Microsoft.WinGet.Client.psm1' - # Version number of this module. - ModuleVersion = '0.0.1' +# Version number of this module. +ModuleVersion = '0.0.1' - # Supported PSEditions - CompatiblePSEditions = 'Desktop', 'Core' +# Supported PSEditions +CompatiblePSEditions = 'Desktop', 'Core' - # ID used to uniquely identify this module - GUID = 'e11157e2-cd24-4250-83b8-c6654ea4926a' +# ID used to uniquely identify this module +GUID = 'e11157e2-cd24-4250-83b8-c6654ea4926a' - # Author of this module - Author = 'Microsoft Corporation' +# Author of this module +Author = 'Microsoft Corporation' - # Company or vendor of this module - CompanyName = 'Microsoft Corporation' +# Company or vendor of this module +CompanyName = 'Microsoft Corporation' - # Copyright statement for this module - Copyright = '(c) Microsoft Corporation. All rights reserved.' +# Copyright statement for this module +Copyright = '(c) Microsoft Corporation. All rights reserved.' - # Description of the functionality provided by this module - Description = 'PowerShell Module for the Windows Package Manager Client.' +# Description of the functionality provided by this module +Description = 'PowerShell Module for the Windows Package Manager Client.' - # Minimum version of the PowerShell engine required by this module - PowerShellVersion = '5.1.0' +# Minimum version of the PowerShell engine required by this module +PowerShellVersion = '5.1.0' - # Name of the PowerShell host required by this module - # PowerShellHostName = '' +# Name of the PowerShell host required by this module +# PowerShellHostName = '' - # Minimum version of the PowerShell host required by this module - # PowerShellHostVersion = '' +# Minimum version of the PowerShell host required by this module +# PowerShellHostVersion = '' - # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. - # DotNetFrameworkVersion = '' +# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. +# DotNetFrameworkVersion = '' - # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. - # ClrVersion = '' +# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. +# ClrVersion = '' - # Processor architecture (None, X86, Amd64) required by this module - # ProcessorArchitecture = '' +# Processor architecture (None, X86, Amd64) required by this module +# ProcessorArchitecture = '' - # Modules that must be imported into the global environment prior to importing this module - # RequiredModules = @() +# Modules that must be imported into the global environment prior to importing this module +# RequiredModules = @() - # Assemblies that must be loaded prior to importing this module - # RequiredAssemblies = @() +# Assemblies that must be loaded prior to importing this module +# RequiredAssemblies = @() - # Script files (.ps1) that are run in the caller's environment prior to importing this module. - # ScriptsToProcess = @() +# Script files (.ps1) that are run in the caller's environment prior to importing this module. +# ScriptsToProcess = @() - # Type files (.ps1xml) to be loaded when importing this module - # TypesToProcess = @() +# Type files (.ps1xml) to be loaded when importing this module +# TypesToProcess = @() - # Format files (.ps1xml) to be loaded when importing this module - FormatsToProcess = 'Format.ps1xml' +# Format files (.ps1xml) to be loaded when importing this module +FormatsToProcess = 'Format.ps1xml' - # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess - NestedModules = if ($env:PROCESSOR_ARCHITECTURE -like 'amd64') { - "x64\$PSEdition\Microsoft.WinGet.Client.dll" - } - elseif ($env:PROCESSOR_ARCHITECTURE -like 'x86') { - "x86\$PSEdition\Microsoft.WinGet.Client.dll" - } - else { - "ARM64\$PSEdition\Microsoft.WinGet.Client.dll" - } +# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess +NestedModules = if ($env:PROCESSOR_ARCHITECTURE -like 'amd64') { + "x64\$PSEdition\Microsoft.WinGet.Client.dll" +} +else { + "x86\$PSEdition\Microsoft.WinGet.Client.dll" +} - # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. - FunctionsToExport = @( - 'Get-WinGetVersion' - 'Get-WinGetVersion', - 'Enable-WinGetSetting', - 'Disable-WinGetSetting', - 'Add-WinGetSource', - 'Remove-WinGetSource', - 'Reset-WinGetSource' - ) +# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. +FunctionsToExport = @( + 'Get-WinGetVersion' + 'Get-WinGetVersion', + 'Enable-WinGetSetting', + 'Disable-WinGetSetting', + 'Add-WinGetSource', + 'Remove-WinGetSource', + 'Reset-WinGetSource' +) - # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. - CmdletsToExport = @( - 'Find-WinGetPackage', - 'Get-WinGetPackage', - 'Get-WinGetSource', - 'Install-WinGetPackage', - 'Uninstall-WinGetPackage', - 'Update-WinGetPackage' - ) +# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. +CmdletsToExport = @( + 'Find-WinGetPackage', + 'Get-WinGetPackage', + 'Get-WinGetSource', + 'Install-WinGetPackage', + 'Uninstall-WinGetPackage', + 'Update-WinGetPackage' +) - # Variables to export from this module - # VariablesToExport = @() +# Variables to export from this module +# VariablesToExport = @() - # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. - AliasesToExport = @() +# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. +AliasesToExport = @() - # DSC resources to export from this module - # DscResourcesToExport = @() +# DSC resources to export from this module +# DscResourcesToExport = @() - # List of all modules packaged with this module - # ModuleList = @() +# List of all modules packaged with this module +# ModuleList = @() - # List of all files packaged with this module - # FileList = @() +# List of all files packaged with this module +# FileList = @() - # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. - PrivateData = @{ +# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. +PrivateData = @{ - PSData = @{ + PSData = @{ - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @( - 'CrescendoBuilt', - 'PSEdition_Desktop', - 'PSEdition_Core', - 'Windows', - 'WindowsPackageManager' - ) + # Tags applied to this module. These help with module discovery in online galleries. + Tags = @( + 'CrescendoBuilt', + 'PSEdition_Desktop', + 'PSEdition_Core', + 'Windows', + 'WindowsPackageManager' + ) - # A URL to the license for this module. - # LicenseUri = '' + # A URL to the license for this module. + # LicenseUri = '' - # A URL to the main website for this project. - ProjectUri = 'https://github.com/microsoft/winget-cli' + # A URL to the main website for this project. + ProjectUri = 'https://github.com/microsoft/winget-cli' - # A URL to an icon representing this module. - # IconUri = '' + # A URL to an icon representing this module. + # IconUri = '' - # ReleaseNotes of this module - # ReleaseNotes = '' + # ReleaseNotes of this module + # ReleaseNotes = '' - # Prerelease string of this module - Prerelease = 'alpha' + # Prerelease string of this module + Prerelease = 'alpha' - # Flag to indicate whether the module requires explicit user acceptance for install/update/save - # RequireLicenseAcceptance = $false + # Flag to indicate whether the module requires explicit user acceptance for install/update/save + # RequireLicenseAcceptance = $false - # External dependent modules of this module - # ExternalModuleDependencies = @() + # External dependent modules of this module + # ExternalModuleDependencies = @() - } # End of PSData hashtable + } # End of PSData hashtable - # CrescendoVersion - CrescendoVersion = '1.0.0' + # CrescendoVersion + CrescendoVersion = '1.0.0' - # CrescendoGenerated - CrescendoGenerated = '07/07/2022 00:00:00' + # CrescendoGenerated + CrescendoGenerated = '07/07/2022 00:00:00' - } # End of PrivateData hashtable +} # End of PrivateData hashtable - # HelpInfo URI of this module - # HelpInfoURI = '' +# HelpInfo URI of this module +# HelpInfoURI = '' - # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. - # DefaultCommandPrefix = '' +# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. +# DefaultCommandPrefix = '' } - diff --git a/src/PowerShell/Microsoft.WinGet.Client/README.md b/src/PowerShell/Microsoft.WinGet.Client/README.md deleted file mode 100644 index 2f862f2178..0000000000 --- a/src/PowerShell/Microsoft.WinGet.Client/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Microsoft.WinGet.Client - -This is the source code for the PowerShell module for the Windows Package Manager Client. - -## Building -### Pre-Requisite Steps - -A **PowerShell module** is merely a folder containing a **.psd1** file or a -**.psm1** file. In this scenario, we will be building a folder with a **.psd1** -file and all of the other necessary bits inside. But, before we do that, we need -to make sure of the following steps. - -1. The project has been built for the **x64**, **x86**, and **ARM64** - platforms in **Release** mode. - - The build script also relies on the exact location and structure of the - actual build files. That is, the build script will look for a **bin** - directory in this folder and expects a directory structure like: - - `bin\x64\Release\net6.0-windows10.0.22000.0\` - - `bin\x86\Release\net461\` - -### Running the Script -Once you've done all of the pre-requisite steps, you can build the PowerShell -module folder by running the PowerShell build script. For example, - -- `.\Build-Module.ps1 -In bin -Out build\bin -Configuration Release` From c8740244e2734ff8c9e0fec574fd6da2a62a67f9 Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Tue, 19 Jul 2022 21:51:45 -0700 Subject: [PATCH 15/21] Initial pipeline pass --- azure-pipelines.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 19fc5b4433..f72f898bfe 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -278,6 +278,12 @@ jobs: TargetFolder: '$(artifactsDir)' condition: succeededOrFailed() + - task: PowerShell@2 + displayName: 'Copy PowerShell Module Binaries to Output' + inputs: + filePath: 'src\PowerShell\Microsoft.WinGet.Client\Copy-PlatformBinaries.ps1' + arguments: '-Platform $(buildPlatform) -Configuration $(buildConfiguration) -OutDir $(Build.ArtifactStagingDirectory)\Microsoft.WinGet.Client' + - task: PublishPipelineArtifact@1 displayName: Publish Pipeline Artifacts inputs: @@ -299,3 +305,20 @@ jobs: - task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@2 displayName: 'Publish Security Analysis Logs' + +- job: 'BuildPowerShellModule' + timeoutInMinutes: 120 + dependsOn: 'Build' + condition: always() + + steps: + - task: PowerShell@2 + displayName: 'Copy PowerShell Module Files to Output' + inputs: + filePath: 'src\PowerShell\Microsoft.WinGet.Client\Copy-ModuleFiles.ps1' + arguments: '-OutDir $(Build.ArtifactStagingDirectory)\Microsoft.WinGet.Client' + + - task: PublishPipelineArtifact@1 + displayName: Publish PowerShell Module Artifacts + inputs: + targetPath: '$(Build.ArtifactStagingDirectory)\Microsoft.WinGet.Client' From 1965b42db540cf2281db89f6ba3f5ec21fa040b6 Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Tue, 19 Jul 2022 22:16:03 -0700 Subject: [PATCH 16/21] Call winrtact_Initialize from type initializer --- .../Common/BaseClientCommand.cs | 9 + .../Common/Constants.cs | 5 - .../Common/Utilities.cs | 4 +- .../Microsoft.WinGet.Client.csproj | 8 +- .../Microsoft.WinGet.Client.psd1 | 2 +- ...urce.Designer.cs => Resources.Designer.cs} | 252 +++++++-------- .../{Resource.resx => Resources.resx} | 288 +++++++++--------- 7 files changed, 285 insertions(+), 283 deletions(-) rename src/PowerShell/Microsoft.WinGet.Client/Properties/{Resource.Designer.cs => Resources.Designer.cs} (95%) rename src/PowerShell/Microsoft.WinGet.Client/Properties/{Resource.resx => Resources.resx} (98%) diff --git a/src/PowerShell/Microsoft.WinGet.Client/Common/BaseClientCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Common/BaseClientCommand.cs index 798e0ef185..4961f03965 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Common/BaseClientCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Common/BaseClientCommand.cs @@ -9,6 +9,7 @@ namespace Microsoft.WinGet.Client.Common using System; using System.Collections.Generic; using System.Management.Automation; + using System.Runtime.InteropServices; using Microsoft.Management.Deployment; using Microsoft.WinGet.Client.Factories; @@ -17,6 +18,11 @@ namespace Microsoft.WinGet.Client.Common /// public class BaseClientCommand : PSCmdlet { + static BaseClientCommand() + { + InitializeUndockedRegFreeWinRT(); + } + /// /// Initializes a new instance of the class. /// @@ -62,5 +68,8 @@ protected static IReadOnlyList GetPackageCatalogReferen }; } } + + [DllImport("winrtact.dll", EntryPoint = "winrtact_Initialize", ExactSpelling = true, PreserveSig = false)] + private static extern void InitializeUndockedRegFreeWinRT(); } } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Common/Constants.cs b/src/PowerShell/Microsoft.WinGet.Client/Common/Constants.cs index 0174f7e97f..ba0b1f01d3 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Common/Constants.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Common/Constants.cs @@ -43,10 +43,5 @@ public static class Constants /// needs to be found by searching a package source. /// public const string FoundSet = "FoundSet"; - - /// - /// This is the path provided to the resource manager to access localized strings. - /// - public const string ResourcesPath = "Microsoft.WinGet.Client.Properties.Resources"; } } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Common/Utilities.cs b/src/PowerShell/Microsoft.WinGet.Client/Common/Utilities.cs index d0b6f5b297..7c9e00bcfc 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Common/Utilities.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Common/Utilities.cs @@ -6,7 +6,6 @@ namespace Microsoft.WinGet.Client.Common { - using System.Reflection; using System.Resources; using System.Security.Principal; @@ -22,8 +21,7 @@ public static ResourceManager ResourceManager { get { - Assembly assembly = Assembly.GetExecutingAssembly(); - return new ResourceManager(Constants.ResourcesPath, assembly); + return new ResourceManager(typeof(Properties.Resources)); } } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj index 764441be32..57386148cb 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj @@ -47,17 +47,17 @@ - + True True - Resource.resx + Resources.resx - + ResXFileCodeGenerator - Resource.Designer.cs + Resources.Designer.cs diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 index 0d8d3ed09e..3b357169e3 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.psd1 @@ -15,7 +15,7 @@ RootModule = 'Microsoft.WinGet.Client.psm1' ModuleVersion = '0.0.1' # Supported PSEditions -CompatiblePSEditions = 'Desktop', 'Core' +CompatiblePSEditions = 'Core' # ID used to uniquely identify this module GUID = 'e11157e2-cd24-4250-83b8-c6654ea4926a' diff --git a/src/PowerShell/Microsoft.WinGet.Client/Properties/Resource.Designer.cs b/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.Designer.cs similarity index 95% rename from src/PowerShell/Microsoft.WinGet.Client/Properties/Resource.Designer.cs rename to src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.Designer.cs index f22f568e26..1133c48286 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Properties/Resource.Designer.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.Designer.cs @@ -1,126 +1,126 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.WinGet.Client.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resource { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resource() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.WinGet.Client.Properties.Resource", typeof(Resource).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to No source matches the given value: {0}. - /// - internal static string ArgumentExceptionInvalidSource { - get { - return ResourceManager.GetString("ArgumentExceptionInvalidSource", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to This cmdlet is currently disabled in an administrative context.. - /// - internal static string ExceptionAdministratorDisabled { - get { - return ResourceManager.GetString("ExceptionAdministratorDisabled", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to An error occurred while searching for packages: {0}. - /// - internal static string FindPackagesExceptionMessage { - get { - return ResourceManager.GetString("FindPackagesExceptionMessage", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to An error occurred while connecting to the catalog.. - /// - internal static string RuntimeExceptionCatalogError { - get { - return ResourceManager.GetString("RuntimeExceptionCatalogError", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No versions matched the given value: {0}. - /// - internal static string RuntimeExceptionInvalidVersion { - get { - return ResourceManager.GetString("RuntimeExceptionInvalidVersion", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No packages matched the given input criteria.. - /// - internal static string RuntimeExceptionNoPackagesFound { - get { - return ResourceManager.GetString("RuntimeExceptionNoPackagesFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0}, {1}, and {2} other packages matched the input criteria. Please refine the input.. - /// - internal static string VagueCriteriaExceptionMessage { - get { - return ResourceManager.GetString("VagueCriteriaExceptionMessage", resourceCulture); - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.WinGet.Client.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.WinGet.Client.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to No source matches the given value: {0}. + /// + internal static string ArgumentExceptionInvalidSource { + get { + return ResourceManager.GetString("ArgumentExceptionInvalidSource", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This cmdlet is currently disabled in an administrative context.. + /// + internal static string ExceptionAdministratorDisabled { + get { + return ResourceManager.GetString("ExceptionAdministratorDisabled", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to An error occurred while searching for packages: {0}. + /// + internal static string FindPackagesExceptionMessage { + get { + return ResourceManager.GetString("FindPackagesExceptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to An error occurred while connecting to the catalog.. + /// + internal static string RuntimeExceptionCatalogError { + get { + return ResourceManager.GetString("RuntimeExceptionCatalogError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No versions matched the given value: {0}. + /// + internal static string RuntimeExceptionInvalidVersion { + get { + return ResourceManager.GetString("RuntimeExceptionInvalidVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No packages matched the given input criteria.. + /// + internal static string RuntimeExceptionNoPackagesFound { + get { + return ResourceManager.GetString("RuntimeExceptionNoPackagesFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0}, {1}, and {2} other packages matched the input criteria. Please refine the input.. + /// + internal static string VagueCriteriaExceptionMessage { + get { + return ResourceManager.GetString("VagueCriteriaExceptionMessage", resourceCulture); + } + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Properties/Resource.resx b/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.resx similarity index 98% rename from src/PowerShell/Microsoft.WinGet.Client/Properties/Resource.resx rename to src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.resx index 4aff5d015a..8632351598 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Properties/Resource.resx +++ b/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.resx @@ -1,145 +1,145 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - No source matches the given value: {0} - {0} - The name of the source that was not found. - - - This cmdlet is currently disabled in an administrative context. - - - An error occurred while searching for packages: {0} - {0} - A string representation of the error status returned by the catalog. - - - An error occurred while connecting to the catalog. - - - No versions matched the given value: {0} - {0} - The version string provided by the user. - - - No packages matched the given input criteria. - - - {0}, {1}, and {2} other packages matched the input criteria. Please refine the input. - {0} - The first conflicting package as a string. {1} - The second conflicting package. {2} - The number of other packages that also matched the input criteria. - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + No source matches the given value: {0} + {0} - The name of the source that was not found. + + + This cmdlet is currently disabled in an administrative context. + + + An error occurred while searching for packages: {0} + {0} - A string representation of the error status returned by the catalog. + + + An error occurred while connecting to the catalog. + + + No versions matched the given value: {0} + {0} - The version string provided by the user. + + + No packages matched the given input criteria. + + + {0}, {1}, and {2} other packages matched the input criteria. Please refine the input. + {0} - The first conflicting package as a string. {1} - The second conflicting package. {2} - The number of other packages that also matched the input criteria. + \ No newline at end of file From b3b906ef38977fe7e560fc181e34f4306b862135 Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Tue, 19 Jul 2022 22:40:18 -0700 Subject: [PATCH 17/21] Spelling --- .github/actions/spelling/expect.txt | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 395884933e..1ffd3d2569 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -71,6 +71,7 @@ cfr cgi cgmanifest chcp +ci cinq CLIE cloudapp @@ -104,10 +105,9 @@ dllimport dnld Dobbeleer Dsc -Dst dustojnikhummer dvinns -ebug +dw ecfr ecfrbrowse EFGH @@ -117,12 +117,12 @@ EQU ERANGE errno ESRB -estination etest execustom EXEHASH experimentalfeatures fcb +fd fdw fedorapeople fileinuse @@ -199,12 +199,14 @@ IZone jdk jfearn JObject +jp jpalardy JREs jrsoftware jsoncpp kayone Keivan +KF KNOWNFOLDERID ktf langs @@ -227,6 +229,8 @@ lpitemidlist LPWSTR LSTATUS LTDA +lw +lz malware maxvalue MBH @@ -251,6 +255,7 @@ MSIXHASH msstore Multideclaration multimap +mx mycustom myinstalldir mylog @@ -272,6 +277,7 @@ npp nsis nuffing nullopt +NX objbase objidl ofile @@ -281,6 +287,7 @@ PARAMETERMAP paramref pathparts Patil +pb PCs pcwsz pdp @@ -309,6 +316,9 @@ pvm pwabuilder PWAs PWSTR +px +pz +qb qword rbegin readonly @@ -394,6 +404,7 @@ ucnv uec uild uintptr +ul uninitialize uninstallation uninstaller @@ -421,6 +432,7 @@ virtualization vns vscode vstest +vy wcslen webpages Webserver @@ -436,6 +448,7 @@ wingetdev winreg winrtact withstarts +wn Workflows wsl wsv @@ -450,3 +463,4 @@ yao ype Zanollo ZIPHASH +zy From fce3e48d8a2dd0fba29c2855c9dce5e11955e2be Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Thu, 21 Jul 2022 12:24:08 -0700 Subject: [PATCH 18/21] Localized progress record activities --- .../Commands/InstallPackageCommand.cs | 4 +- .../Commands/UninstallPackageCommand.cs | 5 +- .../Commands/UpdatePackageCommand.cs | 6 +- .../Properties/Resources.Designer.cs | 279 ++++++++-------- .../Properties/Resources.resx | 300 +++++++++--------- 5 files changed, 320 insertions(+), 274 deletions(-) diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs index 776db8ca29..e9affbb38b 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/InstallPackageCommand.cs @@ -90,7 +90,9 @@ private InstallResult InstallPackage( InstallOptions options) { var operation = PackageManager.Value.InstallPackageAsync(package, options); - return this.RegisterCallbacksAndWait(operation, $"Installing '{package.Name}'"); + return this.RegisterCallbacksAndWait(operation, string.Format( + Utilities.ResourceManager.GetString("ProgressRecordActivityInstalling"), + package.Name)); } } } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs index 8ee919780d..fa95542fde 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/UninstallPackageCommand.cs @@ -63,7 +63,10 @@ private UninstallResult UninstallPackage( CatalogPackage package, UninstallOptions options) { - string activity = $"Uninstalling '{package.Name}'"; + string activity = string.Format( + Utilities.ResourceManager.GetString("ProgressRecordActivityUninstalling"), + package.Name); + var operation = PackageManager.Value.UninstallPackageAsync(package, options); WriteProgressAdapter adapter = new (this); operation.Progress = (context, progress) => diff --git a/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs b/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs index 9a2074656c..109ddc0b3a 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Commands/UpdatePackageCommand.cs @@ -53,8 +53,10 @@ private InstallResult UpgradePackage( CatalogPackage package, InstallOptions options) { - var operation = PackageManager.Value.UpgradePackageAsync(package, options); - return this.RegisterCallbacksAndWait(operation, $"Updating '{package.Name}'"); + var operation = PackageManager.Value.UpgradePackageAsync(package, options); + return this.RegisterCallbacksAndWait(operation, string.Format( + Utilities.ResourceManager.GetString("ProgressRecordActivityUpdating"), + package.Name)); } } } diff --git a/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.Designer.cs b/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.Designer.cs index 1133c48286..2bcc7c6afd 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.Designer.cs +++ b/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.Designer.cs @@ -1,126 +1,153 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.WinGet.Client.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.WinGet.Client.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to No source matches the given value: {0}. - /// - internal static string ArgumentExceptionInvalidSource { - get { - return ResourceManager.GetString("ArgumentExceptionInvalidSource", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to This cmdlet is currently disabled in an administrative context.. - /// - internal static string ExceptionAdministratorDisabled { - get { - return ResourceManager.GetString("ExceptionAdministratorDisabled", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to An error occurred while searching for packages: {0}. - /// - internal static string FindPackagesExceptionMessage { - get { - return ResourceManager.GetString("FindPackagesExceptionMessage", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to An error occurred while connecting to the catalog.. - /// - internal static string RuntimeExceptionCatalogError { - get { - return ResourceManager.GetString("RuntimeExceptionCatalogError", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No versions matched the given value: {0}. - /// - internal static string RuntimeExceptionInvalidVersion { - get { - return ResourceManager.GetString("RuntimeExceptionInvalidVersion", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No packages matched the given input criteria.. - /// - internal static string RuntimeExceptionNoPackagesFound { - get { - return ResourceManager.GetString("RuntimeExceptionNoPackagesFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0}, {1}, and {2} other packages matched the input criteria. Please refine the input.. - /// - internal static string VagueCriteriaExceptionMessage { - get { - return ResourceManager.GetString("VagueCriteriaExceptionMessage", resourceCulture); - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.WinGet.Client.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.WinGet.Client.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to No source matches the given value: {0}. + /// + internal static string ArgumentExceptionInvalidSource { + get { + return ResourceManager.GetString("ArgumentExceptionInvalidSource", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This cmdlet is currently disabled in an administrative context.. + /// + internal static string ExceptionAdministratorDisabled { + get { + return ResourceManager.GetString("ExceptionAdministratorDisabled", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to An error occurred while searching for packages: {0}. + /// + internal static string FindPackagesExceptionMessage { + get { + return ResourceManager.GetString("FindPackagesExceptionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Installing '{0}'. + /// + internal static string ProgressRecordActivityInstalling { + get { + return ResourceManager.GetString("ProgressRecordActivityInstalling", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Uninstalling '{0}'. + /// + internal static string ProgressRecordActivityUninstalling { + get { + return ResourceManager.GetString("ProgressRecordActivityUninstalling", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updating '{0}'. + /// + internal static string ProgressRecordActivityUpdating { + get { + return ResourceManager.GetString("ProgressRecordActivityUpdating", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to An error occurred while connecting to the catalog.. + /// + internal static string RuntimeExceptionCatalogError { + get { + return ResourceManager.GetString("RuntimeExceptionCatalogError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No versions matched the given value: {0}. + /// + internal static string RuntimeExceptionInvalidVersion { + get { + return ResourceManager.GetString("RuntimeExceptionInvalidVersion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No packages matched the given input criteria.. + /// + internal static string RuntimeExceptionNoPackagesFound { + get { + return ResourceManager.GetString("RuntimeExceptionNoPackagesFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0}, {1}, and {2} other packages matched the input criteria. Please refine the input.. + /// + internal static string VagueCriteriaExceptionMessage { + get { + return ResourceManager.GetString("VagueCriteriaExceptionMessage", resourceCulture); + } + } + } +} diff --git a/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.resx b/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.resx index 8632351598..711ba74d6f 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.resx +++ b/src/PowerShell/Microsoft.WinGet.Client/Properties/Resources.resx @@ -1,145 +1,157 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - No source matches the given value: {0} - {0} - The name of the source that was not found. - - - This cmdlet is currently disabled in an administrative context. - - - An error occurred while searching for packages: {0} - {0} - A string representation of the error status returned by the catalog. - - - An error occurred while connecting to the catalog. - - - No versions matched the given value: {0} - {0} - The version string provided by the user. - - - No packages matched the given input criteria. - - - {0}, {1}, and {2} other packages matched the input criteria. Please refine the input. - {0} - The first conflicting package as a string. {1} - The second conflicting package. {2} - The number of other packages that also matched the input criteria. - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + No source matches the given value: {0} + {0} - The name of the source that was not found. + + + This cmdlet is currently disabled in an administrative context. + + + An error occurred while searching for packages: {0} + {0} - A string representation of the error status returned by the catalog. + + + Installing '{0}' + {0} - The name of the package being installed. + + + Uninstalling '{0}' + {0} - The name of the package being uninstalled. + + + Updating '{0}' + {0} - The name of the package being updated. + + + An error occurred while connecting to the catalog. + + + No versions matched the given value: {0} + {0} - The version string provided by the user. + + + No packages matched the given input criteria. + + + {0}, {1}, and {2} other packages matched the input criteria. Please refine the input. + {0} - The first conflicting package as a string. {1} - The second conflicting package. {2} - The number of other packages that also matched the input criteria. + \ No newline at end of file From 04e93f170851d962253ecd1e78b6f6adbe8785bd Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Thu, 21 Jul 2022 15:07:14 -0700 Subject: [PATCH 19/21] Download artifacts before publishing --- azure-pipelines.yml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f72f898bfe..20b53febf7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -282,7 +282,7 @@ jobs: displayName: 'Copy PowerShell Module Binaries to Output' inputs: filePath: 'src\PowerShell\Microsoft.WinGet.Client\Copy-PlatformBinaries.ps1' - arguments: '-Platform $(buildPlatform) -Configuration $(buildConfiguration) -OutDir $(Build.ArtifactStagingDirectory)\Microsoft.WinGet.Client' + arguments: '-Platform $(buildPlatform) -Configuration $(buildConfiguration) -OutDir $(artifactsDir)\PowerShell' - task: PublishPipelineArtifact@1 displayName: Publish Pipeline Artifacts @@ -312,13 +312,30 @@ jobs: condition: always() steps: + - task: DownloadPipelineArtifact@2 + displayName: 'Download Build Artifacts' + + - task: CopyFiles@2 + displayName: 'Copy x64 PowerShell Binaries to Output' + inputs: + SourceFolder: '$(Pipeline.Workspace)\Build.x64release\PowerShell' + Contents: '**\*' + TargetFolder: '$(Build.ArtifactStagingDirectory)' + + - task: CopyFiles@2 + displayName: 'Copy x86 PowerShell Binaries to Output' + inputs: + SourceFolder: '$(Pipeline.Workspace)\Build.x86release\PowerShell' + Contents: '**\*' + TargetFolder: '$(Build.ArtifactStagingDirectory)' + - task: PowerShell@2 displayName: 'Copy PowerShell Module Files to Output' inputs: filePath: 'src\PowerShell\Microsoft.WinGet.Client\Copy-ModuleFiles.ps1' - arguments: '-OutDir $(Build.ArtifactStagingDirectory)\Microsoft.WinGet.Client' + arguments: '-OutDir $(Build.ArtifactStagingDirectory)' - task: PublishPipelineArtifact@1 displayName: Publish PowerShell Module Artifacts inputs: - targetPath: '$(Build.ArtifactStagingDirectory)\Microsoft.WinGet.Client' + targetPath: '$(Build.ArtifactStagingDirectory)' From 04960da271dc7ac14c720f0eb6eda806b14a022e Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Mon, 25 Jul 2022 15:37:26 -0700 Subject: [PATCH 20/21] Add event to ensure winrtact.dll is copied --- .../Microsoft.WinGet.Client.csproj | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj index 57386148cb..162988e6a4 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj @@ -68,4 +68,13 @@ 10.0.17763.0 + + + + + + + + + \ No newline at end of file From 85f3a8c8a7f1c5680d564660efeb00d9bc2c7809 Mon Sep 17 00:00:00 2001 From: Jonathan Abbott Date: Tue, 26 Jul 2022 10:53:12 -0700 Subject: [PATCH 21/21] Change to copy correct configuration --- src/AppInstallerCLI.sln | 23 +++++++++---------- .../Microsoft.WinGet.Client.csproj | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/AppInstallerCLI.sln b/src/AppInstallerCLI.sln index 49a17a0b07..8cdd769c1c 100644 --- a/src/AppInstallerCLI.sln +++ b/src/AppInstallerCLI.sln @@ -140,7 +140,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PowerShell", "PowerShell", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.WinGet.Client", "PowerShell\Microsoft.WinGet.Client\Microsoft.WinGet.Client.csproj", "{463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Management.Deployment.Projection", "Microsoft.Management.Deployment.Projection\Microsoft.Management.Deployment.Projection.csproj", "{0B104762-5CD8-47EE-A904-71C1C3F84DCD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Management.Deployment.Projection", "Microsoft.Management.Deployment.Projection\Microsoft.Management.Deployment.Projection.csproj", "{0B104762-5CD8-47EE-A904-71C1C3F84DCD}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UndockedRegFreeWinRT", "UndockedRegFreeWinRT\UndockedRegFreeWinRT\UndockedRegFreeWinRT.vcxproj", "{31ED69A8-5310-45A9-953F-56C351D2C3E1}" EndProject @@ -1049,7 +1049,6 @@ Global {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|ARM64.ActiveCfg = Debug|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|ARM64.Build.0 = Debug|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x64.ActiveCfg = Debug|x64 - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x64.Build.0 = Debug|x64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x86.ActiveCfg = Debug|x86 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Fuzzing|x86.Build.0 = Debug|x86 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.Release|Any CPU.ActiveCfg = Release|ARM64 @@ -1064,8 +1063,8 @@ Global {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM.ActiveCfg = Debug|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM64.ActiveCfg = Debug|ARM64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|ARM64.Build.0 = Debug|ARM64 - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x64.ActiveCfg = Debug|x64 - {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x64.Build.0 = Debug|x64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x64.ActiveCfg = Release|x64 + {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x64.Build.0 = Release|x64 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x86.ActiveCfg = Debug|x86 {463C0EF3-DF38-4C3D-8E7E-D4901E0CDC6C}.TestRelease|x86.Build.0 = Debug|x86 {0B104762-5CD8-47EE-A904-71C1C3F84DCD}.Debug|Any CPU.ActiveCfg = Debug|x86 @@ -1110,16 +1109,16 @@ Global {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|Any CPU.ActiveCfg = Debug|Win32 {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|ARM.ActiveCfg = Debug|Win32 {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|ARM64.ActiveCfg = Debug|Win32 - {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|x64.ActiveCfg = Debug|x64 - {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|x64.Build.0 = Debug|x64 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|x64.ActiveCfg = Release|x64 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|x64.Build.0 = Release|x64 {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|x86.ActiveCfg = Debug|Win32 {31ED69A8-5310-45A9-953F-56C351D2C3E1}.Release|x86.Build.0 = Debug|Win32 {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|Any CPU.ActiveCfg = Debug|Win32 {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|Any CPU.Build.0 = Debug|Win32 {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|ARM.ActiveCfg = Debug|Win32 {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|ARM64.ActiveCfg = Debug|Win32 - {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|x64.ActiveCfg = Debug|x64 - {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|x64.Build.0 = Debug|x64 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|x64.ActiveCfg = Release|x64 + {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|x64.Build.0 = Release|x64 {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|x86.ActiveCfg = Debug|Win32 {31ED69A8-5310-45A9-953F-56C351D2C3E1}.TestRelease|x86.Build.0 = Debug|Win32 {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Debug|Any CPU.ActiveCfg = Debug|Win32 @@ -1138,16 +1137,16 @@ Global {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|Any CPU.ActiveCfg = Debug|Win32 {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|ARM.ActiveCfg = Debug|Win32 {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|ARM64.ActiveCfg = Debug|Win32 - {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|x64.ActiveCfg = Debug|x64 - {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|x64.Build.0 = Debug|x64 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|x64.ActiveCfg = Release|x64 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|x64.Build.0 = Release|x64 {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|x86.ActiveCfg = Debug|Win32 {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.Release|x86.Build.0 = Debug|Win32 {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|Any CPU.ActiveCfg = Debug|Win32 {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|Any CPU.Build.0 = Debug|Win32 {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|ARM.ActiveCfg = Debug|Win32 {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|ARM64.ActiveCfg = Debug|Win32 - {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|x64.ActiveCfg = Debug|x64 - {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|x64.Build.0 = Debug|x64 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|x64.ActiveCfg = Release|x64 + {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|x64.Build.0 = Release|x64 {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|x86.ActiveCfg = Debug|Win32 {787EC629-C0FB-4BA9-9746-4A82CD06B73E}.TestRelease|x86.Build.0 = Debug|Win32 EndGlobalSection diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj index 162988e6a4..05e491c8f4 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj @@ -71,7 +71,7 @@ - +