Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-WinGetManifest does not work with .yaml files because it's relying on a missing variable #179

Open
ghost opened this issue Oct 4, 2022 · 1 comment
Assignees

Comments

@ghost
Copy link

ghost commented Oct 4, 2022

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
@RDMacLachlan
Copy link
Member

Thank you for the feedback.

@RDMacLachlan RDMacLachlan self-assigned this Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant