Open

Description
Brief description of your issue
Attempting to use Add-WinGetManifest to add a .yaml file. This eventually calls into Get-WinGetManifest. This does a check for $WinGetDesktopAppInstallerLibLoaded which is never set, so this code path will always fail. Working around this requires manually setting a global $WinGetDesktopAppInstallerLibLoaded value before running the cmdlet.
Tip: Using Set-StrictMode -Version Latest
in every cmdlet script would help to catch issues like this as it will write an error when trying to reference an unset variable.
Steps to reproduce
Run Add-WinGetManifest and point it to a yaml file:
Add-WinGetManifest -FunctionName xxx -Path d:\path\to\manifest.yaml
Expected behavior
Should work
Actual behavior
Fails:
PS D:\b\winget-cli-restsource-ameltzer\bin> add-wingetmanifest -FunctionName "xxx" -Path D:\path\to\manifest.yaml -Verbose
[snip]
VERBOSE: Retrieving a copy of the app Manifest file for submission to WinGet source.
VERBOSE: Retrieving the Package Manifest for: D:\path\to\manifest.yaml
VERBOSE: Retrieved content from the manifest (manifest.yaml).
Get-WinGetManifest: D:\b\winget-cli-restsource-ameltzer\bin\Library\Add-WinGetManifest.ps1:109:32
Line |
109 | $ApplicationManifest = Get-WinGetManifest -Path $Path
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unable to process YAML files. Re-import the module to reload the required dependencies.
VERBOSE: Returning (0) manifests based on search.
Exception: D:\b\winget-cli-restsource-ameltzer\bin\Library\Add-WinGetManifest.ps1:111:13
Line |
111 | throw "Failed to retrieve a proper manifest. Verify and t …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Failed to retrieve a proper manifest. Verify and try again.
Environment
N/A