winget-cli

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

README.md (2820B)


      1 # Windows Package Manager PowerShell Module
      2 
      3 The Windows Package Manager PowerShell Module is made up on two components
      4 
      5 1. The `Microsoft.WinGet.Client.Cmdlets` project which contains cmdlet implementations.
      6 2. The `Microsoft.WinGet.Client.Engine` project which contain the real logic for the cmdlets.
      7 
      8 ## Building the PowerShell Module Locally
      9 
     10 After building the Microsoft.WinGet.Client.Cmdlets project, the `Microsoft.WinGet.Client` PowerShell module can be found in the output directory in the `PowerShell` folder. For example if you built the project as x64 release, you should expect to find the module files in `$(SolutionDirectory)/src/x64/Release/PowerShell`.
     11 
     12 This project has after build targets that will copy all the necessary files in the correct location.
     13 
     14 ## Adding a new cmdlet
     15 In order to avoid [assembly dependency conflicts](https://learn.microsoft.com/en-us/powershell/scripting/dev-cross-plat/resolving-dependency-conflicts?view=powershell-7.3) this project uses a custom `AssemblyLoadContext` that load all dependencies.
     16 
     17 Microsoft.WinGet.Client.Cmdlets.dll is the binary that gets loaded when the module is imported. When Microsoft.WinGet.Client.Engine.dll is getting loaded the resolving handler use the custom ALC to load it. Then all the dependencies of that binary will be loaded using that custom context.
     18 
     19 The dependencies are laid out in two directories: `DirectDependencies` and `SharedDependencies`. The resolving handler looks for binaries under `DirectDependencies` and uses the custom ALC to load them. The custom ALC load any binaries in `DirectDependencies` and `SharedDependencies`.
     20 
     21 Exception: WinRT.Runtime.dll doesn't support getting loaded in multiple times in the same process, because it affects static state in the CLR itself. We special case it to get loaded in by the default loader.
     22 
     23 If the new cmdlet introduces a new dependency, please make sure to add it in the after build targets to copy it in the Dependencies directory.
     24 
     25 ## Cmdlets
     26 - Assert-WinGetPackageManager
     27 - Find-WinGetPackage
     28 - Get-WinGetPackage
     29 - Get-WinGetSource
     30 - Get-WinGetUserSetting
     31 - Get-WinGetVersion
     32 - Install-WinGetPackage
     33 - Repair-WinGetPackageManager
     34 - Set-WinGetUserSetting
     35 - Test-WinGetUserSetting
     36 - Uninstall-WinGetPackage
     37 - Update-WinGetPackage
     38 - Add-WinGetSource
     39 - Disable-WinGetSetting
     40 - Enable-WinGetSetting
     41 - Get-WinGetSetting
     42 - Remove-WinGetSource
     43 - Reset-WinGetSource
     44 - Repair-WinGetPackage
     45 
     46 ## Quick Start Guide
     47 
     48 **To run the module, make sure you are using the latest version of PowerShell (not Windows PowerShell)**. 
     49 
     50 ```
     51 winget install --id Microsoft.Powershell
     52 ```
     53 
     54 Import the module manifest (Microsoft.WinGet.Client.psd1) by running the following command:
     55 
     56 ```
     57 Import-Module <Path to Microsoft.WinGet.Client.psd1>
     58 ```