microsoft / winget-cli-restsource

This project aims to provide a reference implementation for creating a REST based package source for the winget client.
MIT License
242 stars 62 forks source link

README.md is missing information required to get the PowerShell module to import properly. #172

Open ghost opened 2 years ago

ghost commented 2 years ago

Brief description of your issue

After freshly cloning and building the repository, the Tools\PowerShellModule\src\Microsoft.WinGet.Source.psd1 module cannot be imported:

Add-Type : Cannot bind parameter 'Path' to the target. Exception setting "Path": "Cannot find path
'C:\src\winget-cli-restsource\Tools\PowershellModule\src\Library\HelperLib\x64\Microsoft.Winget.PowershellSupport.dll'
because it does not exist."
At C:\src\winget-cli-restsource\Tools\PowershellModule\src\Microsoft.WinGet.Source.psm1:24 char:32
+ ... -Type -Path "$PSScriptRoot\Library\HelperLib\x64\Microsoft.Winget.Pow ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Add-Type], ParameterBindingException
    + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.PowerShell.Commands.AddTypeCommand

In fact, there's no Tools\PowerShellModule\src\Library\HelperLib\x64 path at all.

I manually copied the contents of %reporoot%\src\WinGet.RestSource.PowerShell\bin\debug\netstandard2.1 into %reporoot%\Tools\PowerShellModule\src\Library\HelperLib\x64 which appeared to be enough to allow the Microsoft.WinGet.Source.psd1 file to import.

I'm reporting this because I didn't see any mention of this in the README.md, and this is critical information needed to get the cmdlets to work. The docs should be updated to make sure these steps are mentioned so that the PowerShell module is usable.

RDMacLachlan commented 2 years ago

Hi @ameltzerMSFT, the inclusion of the ..\HelperLib\x64 is included as part of the Released PowerShell module. On a new release of the project the HelperLib is included in the PowerShell module compressed folder.

ghost commented 2 years ago

Thanks. I don't recall seeing anything about this in the README and I was approaching this from a "clone the git repo, build it, and use it" but this doesn't seem to be the case.

ElianeMegert commented 1 year ago

Hi @ameltzerMSFT, the inclusion of the ..\HelperLib\x64 is included as part of the Released PowerShell module. On a new release of the project the HelperLib is included in the PowerShell module compressed folder.

just downloaded the latest release and the file (and folder) is missing in WinGet.RestSource-Winget.PowerShell.Source.zip. No such folder as HelperLib\x64. Copied the file from WinGet.RestSource-WinGet.RestSource.Functions\bin