I have followed this guide: https://learn.microsoft.com/en-us/azure/devops/artifacts/tutorials/private-powershell-library?view=azure-devops and provisioned a PowerShell module, MyModule, in a Azure DevOps feed.
I have setup my local machine with a PAT token and a private, trusted PSRepository called MyRepo.
When I run Find-Module -Name MyModule -Repository MyRepo
, it finds MyModule, but if I pipe that into Install-Module
i get the following error:
Install-Package: Cannot find the path 'C:\Users\Me\AppData\Local\Temp\355836562\MyModule.0.0.2\MyModule.psd1' because it does not exist.
Verbose output from the Install-Module command:
VERBOSE: Downloading module 'MyModule' with version '0.0.2' from the repository 'https://pkgs.dev.azure.com/MyOrg/MyProject/_packaging/MyModule/nuget/v2'.
VERBOSE: Searching repository 'https://pkgs.dev.azure.com/MyOrg/MyProject/_packaging/MyModule/nuget/v2/FindPackagesById()?id='MyModule'' for ''.
VERBOSE: InstallPackage' - name='MyModule', version='0.0.2',destination='C:\Users\Me\AppData\Local\Temp\1414719836'
VERBOSE: DownloadPackage' - name='MyModule', version='0.0.2',destination='C:\Users\Ax\AppData\Local\Temp\1414719836\MyModule.0.0.2\MyModule.0.0.2.nupkg', uri='https://pkgs.dev.azure.com/MyOrg/MyProject/_packaging/MyModule/nuget/v2?id=mymodule&version=0.0.2'
VERBOSE: Downloading 'https://pkgs.dev.azure.com/MyOrg/MyProject/_packaging/MyModule/nuget/v2?id=mymodule&version=0.0.2'.
VERBOSE: Completed downloading 'https://pkgs.dev.azure.com/MyOrg/MyProject/_packaging/MyModule/nuget/v2?id=mymodule&version=0.0.2'.
VERBOSE: Completed downloading 'MyModule'.
VERBOSE: Hash not found for the package 'MyModule'.
VERBOSE: InstallPackageLocal' - name='MyModule', version='0.0.2',destination='C:\Users\Me\AppData\Local\Temp\1414719836'
VERBOSE: Validating the 'MyModule' module contents under 'C:\Users\Me\AppData\Local\Temp\1414719836\MyModule.0.0.2' path.
Install-Package: Cannot find the path 'C:\Users\Me\AppData\Local\Temp\1414719836\MyModule.0.0.2\MyModule.psd1' because it does not exist.
I can publish the same module to the PowerShell Gallery and load it just fine from there.
I think it might be something with the version number in the folder name, but for now I am pretty clueless.
Has anyone stumbled opun a similar issue?
Config:
PS> $PSVersionTable
Name Value
---- -----
PSVersion 7.3.7
PSEdition Core
GitCommitId 7.3.7
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
PS> Get-Module powershellget -ListAvailable
Directory: C:\program files\powershell\7\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 2.2.5 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-M…
Turns out it is no longer supported. Changing to PSResourceGet as described here: https://devblogs.microsoft.com/powershell/psresourceget-preview-is-now-available/ solved my issue.