Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
Steps to reproduce
- Create an Azure DevOps Package Feed
- Upload a module with a Semver Pre-release Version Tag with Uppercase letters (Such as 1.0.1-PREv001)
- Register the repository using register-psresourcerepository and SPECIFICALLY the V3 feed
- Try and download your module with either save-psresource or install-psresource
- Encounter error -> Save-PSResource: Package with name 'AzureDevopsTest' and version '1.0.1-PREv001' could not be found in repository 'AzureTestRepo'
OBSERVATIONS:
- Everything works ok if I use a V2 feed in Azure DevOps
- Since this document: private-powershell-library on microsoft Learn website has a specific note to use V3, this is not a desired outcome.
- Using github packages also works without an issue
- Using a non pre-release module works without issue (E.g. version 1.0.1) in Azure Packages.
- Using a prerelease tag that is all LOWERCASE (E.g. version 1.0.2-prev001) works without issue in Azure packages
HYPOTHESIS:
I suspect that the issue may be related to case sensitivity in the version string handling, particularly in the IsLatestVersionFirstForInstall() method. The packageContent URL in the metadata response has the version in lowercase (1.0.1-prev007), while the actual version string retains its original casing (1.0.1-PREv007). This inconsistency might be causing the method to fail in reconciling the version strings.
The issue does not occur with GitHub Packages, as the packageContent URL retains the casing of the version string.
Worth noting that invoking the rest API directly against Azure package feeds DOES NOT care about the casing at all, implying this is a problem with PSResourceGet when it is doing some version check.
Expected behavior
#Nuget V3 Feeds from Github Packages DO NOT exhibit this error
find-psresource -Repository ghpackagetest2 -Type Module -Name AstroCmdlets -Prerelease -Verbose
VERBOSE: credential successfully read from vault and set for repository: ghpackagetest2
Name Version Prerelease Repository Description
---- ------- ---------- ---------- -----------
astrocmdlets 1.0.12 PREv002 ghpackagetest2 A test module
find-psresource -Repository ghpackagetest2 -Type Module -Name AstroCmdlets -Prerelease -Verbose|Save-PSResource -Path c:\temp -Verbose -Debug
VERBOSE: credential successfully read from vault and set for repository: ghpackagetest2
DEBUG: In SavePSResource::ProcessSaveHelper()
DEBUG: In InstallHelper::BeginInstallPackages()
DEBUG: Parameters passed in >>> Name: 'astrocmdlets'; VersionRange: '1.0.12-PREv002'; NuGetVersion: '1.0.12-PREv002'; VersionType: 'SpecificVersion'; Version: '1.0.12-PREv002'; Prerelease: 'True'; Repository: 'ghpackagetest2'; AcceptLicense: 'False'; Quiet: 'False'; Reinstall: 'True'; TrustRepository: 'False'; NoClobber: 'False'; AsNupkg: 'False'; IncludeXml 'False'; SavePackage 'True'; TemporaryPath ''; SkipDependencyCheck: 'False'; AuthenticodeCheck: 'False'; PathsToInstallPkg: 'C:\temp'; Scope ''
DEBUG: In InstallHelper::ProcessRepositories()
VERBOSE: credential successfully read from vault and set for repository: ghpackagetest2
VERBOSE: Attempting to search for packages in 'ghpackagetest2'
VERBOSE: Checking if untrusted repository should be used
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its Trusted value by running the Set-PSResourceRepository cmdlet. Are you sure you want
to install the PSResource from 'ghpackagetest2'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
WARNING: Installing dependencies is not currently supported for V3 server protocol repositories. The package will be installed without installing dependencies.
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): y
DEBUG: In InstallHelper::InstallPackages()
DEBUG: In InstallHelper::InstallPackage()
DEBUG: In V3ServerAPICalls::FindVersion()
DEBUG: In V3ServerAPICalls::FindVersionHelper()
DEBUG: 'astrocmdlets' version parsed as '1.0.12-PREv002'
DEBUG: In V3ServerAPICalls::GetVersionedPackageEntriesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::GetResourcesFromServiceIndex()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://nuget.pkg.github.com/{redacted}/index.json'
DEBUG: In V3ServerAPICalls::FindRegistrationsBaseUrl()
DEBUG: In V3ServerAPICalls::GetVersionedResponsesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://nuget.pkg.github.com/{redacted}/astrocmdlets/index.json'
DEBUG: In V3ServerAPICalls::GetMetadataElementsFromResponse()
DEBUG: In V3ServerAPICalls::GetMetadataElementFromItemsElement()
DEBUG: In V3ServerAPICalls::IsLatestVersionFirstForSearch()
Confirm
Are you sure you want to perform this action?
Performing the operation "Save-PSResource" on target "Package to save: 'astrocmdlets', version: '1.0.12-PREv002'".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Confirm
Are you sure you want to perform this action?
Performing the operation "Save-PSResource" on target "Package to install: 'astrocmdlets', version: '1.0.12-PREv002'".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
DEBUG: In V3ServerAPICalls::InstallPackage()
DEBUG: In V3ServerAPICalls::InstallVersion()
DEBUG: In V3ServerAPICalls::InstallHelper()
DEBUG: In V3ServerAPICalls::GetVersionedPackageEntriesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::GetResourcesFromServiceIndex()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://nuget.pkg.github.com/{redacted}/index.json'
DEBUG: In V3ServerAPICalls::FindRegistrationsBaseUrl()
DEBUG: In V3ServerAPICalls::GetVersionedResponsesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://nuget.pkg.github.com/{redacted}/astrocmdlets/index.json'
DEBUG: In V3ServerAPICalls::GetMetadataElementsFromResponse()
DEBUG: In V3ServerAPICalls::GetMetadataElementFromItemsElement()
DEBUG: In V3ServerAPICalls::IsLatestVersionFirstForInstall()
DEBUG: In V3ServerAPICalls::HttpRequestCallForContent()
DEBUG: Request url is 'https://nuget.pkg.github.com/{redacted}/download/astrocmdlets/1.0.12-PREv002/astrocmdlets.1.0.12-PREv002.nupkg'
DEBUG: In InstallHelper::TryInstallToTempPath()
DEBUG: In InstallHelper::CallAcceptLicense()
DEBUG: In InstallHelper::DeleteExtraneousFiles()
DEBUG: Deleting 'C:\Users\adria\AppData\Local\Temp\49a75433-c039-478c-8da6-c11935463bb4\astrocmdlets\1.0.12\astrocmdlets.nuspec'
DEBUG: Deleting 'C:\Users\adria\AppData\Local\Temp\49a75433-c039-478c-8da6-c11935463bb4\astrocmdlets\1.0.12\[Content_Types].xml'
DEBUG: Deleting 'C:\Users\adria\AppData\Local\Temp\49a75433-c039-478c-8da6-c11935463bb4\astrocmdlets\1.0.12\package'
WARNING: Installing dependencies is not currently supported for V3 server protocol repositories. The package will be installed without installing dependencies.
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): y
DEBUG: In InstallHelper::TryMoveInstallContent()
DEBUG: In InstallHelper::MoveFilesIntoInstallPath()
VERBOSE: Installation source path is: 'C:\Users\adria\AppData\Local\Temp\49a75433-c039-478c-8da6-c11935463bb4\astrocmdlets\1.0.12'
VERBOSE: Installation destination path is: 'C:\temp\astrocmdlets\1.0.12'
VERBOSE: Attempting to move 'C:\Users\adria\AppData\Local\Temp\49a75433-c039-478c-8da6-c11935463bb4\astrocmdlets\1.0.12' to 'C:\temp\astrocmdlets\1.0.12'
VERBOSE: Successfully installed package 'astrocmdlets' to location 'C:\temp'
VERBOSE: Attempting to delete 'C:\Users\adria\AppData\Local\Temp\49a75433-c039-478c-8da6-c11935463bb4'
VERBOSE: Successfully deleted 'C:\Users\adria\AppData\Local\Temp\49a75433-c039-478c-8da6-c11935463bb4'
#Lowercase PreRelease labels also work without error:
Find-PSResource -Repository AzureTestRepo -Prerelease -Name azdt2
Name Version Prerelease Repository Description
---- ------- ---------- ---------- -----------
azdt2 1.0.2 prev001 AzureTestRepo Test Module 2
Find-PSResource -Repository AzureTestRepo -Prerelease -Name azdt2|Save-PSResource -path C:\temp\ -Debug -Verbose
DEBUG: In SavePSResource::ProcessSaveHelper()
DEBUG: In InstallHelper::BeginInstallPackages()
DEBUG: Parameters passed in >>> Name: 'azdt2'; VersionRange: '1.0.2-prev001'; NuGetVersion: '1.0.2-prev001'; VersionType: 'SpecificVersion'; Version: '1.0.2-prev001'; Prerelease: 'True'; Repository: 'AzureTestRepo'; AcceptLicense: 'False'; Quiet: 'False'; Reinstall: 'True'; TrustRepository: 'False'; NoClobber: 'False'; AsNupkg: 'False'; IncludeXml 'False'; SavePackage 'True'; TemporaryPath ''; SkipDependencyCheck: 'False'; AuthenticodeCheck: 'False'; PathsToInstallPkg: 'C:\temp\'; Scope ''
DEBUG: In InstallHelper::ProcessRepositories()
VERBOSE: credential successfully read from vault and set for repository: AzureTestRepo
VERBOSE: Attempting to search for packages in 'AzureTestRepo'
WARNING: Installing dependencies is not currently supported for V3 server protocol repositories. The package will be installed without installing dependencies.
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): y
DEBUG: In InstallHelper::InstallPackages()
DEBUG: In InstallHelper::InstallPackage()
DEBUG: In V3ServerAPICalls::FindVersion()
DEBUG: In V3ServerAPICalls::FindVersionHelper()
DEBUG: 'azdt2' version parsed as '1.0.2-prev001'
DEBUG: In V3ServerAPICalls::GetVersionedPackageEntriesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::GetResourcesFromServiceIndex()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pkgs.dev.azure.com/{redacted}/_packaging/TestFeed/nuget/v3/index.json'
DEBUG: In V3ServerAPICalls::FindRegistrationsBaseUrl()
DEBUG: In V3ServerAPICalls::GetVersionedResponsesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pkgs.dev.azure.com/{redacted}/_packaging/ae0aabff-43f2-48bb-b15e-16a4aadc1d43/nuget/v3/registrations2-semver2/azdt2/index.json'
DEBUG: In V3ServerAPICalls::GetMetadataElementsFromResponse()
DEBUG: In V3ServerAPICalls::GetMetadataElementFromItemsElement()
DEBUG: In V3ServerAPICalls::IsLatestVersionFirstForSearch()
Confirm
Are you sure you want to perform this action?
Performing the operation "Save-PSResource" on target "Package to save: 'azdt2', version: '1.0.2-prev001'".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Confirm
Are you sure you want to perform this action?
Performing the operation "Save-PSResource" on target "Package to install: 'azdt2', version: '1.0.2-prev001'".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
DEBUG: In V3ServerAPICalls::InstallPackage()
DEBUG: In V3ServerAPICalls::InstallVersion()
DEBUG: In V3ServerAPICalls::InstallHelper()
DEBUG: In V3ServerAPICalls::GetVersionedPackageEntriesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::GetResourcesFromServiceIndex()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pkgs.dev.azure.com/{redacted}/_packaging/TestFeed/nuget/v3/index.json'
DEBUG: In V3ServerAPICalls::FindRegistrationsBaseUrl()
DEBUG: In V3ServerAPICalls::GetVersionedResponsesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pkgs.dev.azure.com/{redacted}/nuget/v3/registrations2-semver2/azdt2/index.json'
DEBUG: In V3ServerAPICalls::GetMetadataElementsFromResponse()
DEBUG: In V3ServerAPICalls::GetMetadataElementFromItemsElement()
DEBUG: In V3ServerAPICalls::IsLatestVersionFirstForInstall()
DEBUG: In V3ServerAPICalls::HttpRequestCallForContent()
DEBUG: Request url is 'https://pkgs.dev.azure.com/{redacted}/nuget/v3/flat2/azdt2/1.0.2-prev001/azdt2.1.0.2-prev001.nupkg'
DEBUG: In InstallHelper::TryInstallToTempPath()
DEBUG: In InstallHelper::CallAcceptLicense()
DEBUG: In InstallHelper::DeleteExtraneousFiles()
DEBUG: Deleting 'C:\Users\adria\AppData\Local\Temp\acb1f5be-74a3-4b67-95b2-fa60c8b33d10\azdt2\1.0.2\azdt2.nuspec'
DEBUG: Deleting 'C:\Users\adria\AppData\Local\Temp\acb1f5be-74a3-4b67-95b2-fa60c8b33d10\azdt2\1.0.2\[Content_Types].xml'
DEBUG: Deleting 'C:\Users\adria\AppData\Local\Temp\acb1f5be-74a3-4b67-95b2-fa60c8b33d10\azdt2\1.0.2\_rels'
DEBUG: Deleting 'C:\Users\adria\AppData\Local\Temp\acb1f5be-74a3-4b67-95b2-fa60c8b33d10\azdt2\1.0.2\package'
WARNING: Installing dependencies is not currently supported for V3 server protocol repositories. The package will be installed without installing dependencies.
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): y
DEBUG: In InstallHelper::TryMoveInstallContent()
DEBUG: In InstallHelper::MoveFilesIntoInstallPath()
VERBOSE: Installation source path is: 'C:\Users\adria\AppData\Local\Temp\acb1f5be-74a3-4b67-95b2-fa60c8b33d10\azdt2\1.0.2'
VERBOSE: Installation destination path is: 'C:\temp\azdt2\1.0.2'
VERBOSE: Attempting to move 'C:\Users\adria\AppData\Local\Temp\acb1f5be-74a3-4b67-95b2-fa60c8b33d10\azdt2\1.0.2' to 'C:\temp\azdt2\1.0.2'
VERBOSE: Successfully installed package 'azdt2' to location 'C:\temp\'
VERBOSE: Attempting to delete 'C:\Users\adria\AppData\Local\Temp\acb1f5be-74a3-4b67-95b2-fa60c8b33d10'
VERBOSE: Successfully deleted 'C:\Users\adria\AppData\Local\Temp\acb1f5be-74a3-4b67-95b2-fa60c8b33d10'
Actual behavior
Find-PSResource -Repository AzureTestRepo -Prerelease -Name AzureDevopstest -Verbose
VERBOSE: credential successfully read from vault and set for repository: AzureTestRepo
Name Version Prerelease Repository Description
---- ------- ---------- ---------- -----------
AzureDevopsTest 1.0.1 PREv007 AzureTestRepo AA Testing out Module Forge in Azure DevOps
Save-PSResource -Path C:\temp -Debug -Verbose -ErrorAction stop -Repository AzureTestRepo -Prerelease -Name AzureDevopstest -Version '1.0.1-PREv007'
DEBUG: In SavePSResource::ProcessSaveHelper()
DEBUG: In InstallHelper::BeginInstallPackages()
DEBUG: Parameters passed in >>> Name: 'AzureDevopstest'; VersionRange: '1.0.1-PREv007'; NuGetVersion: '1.0.1-PREv007'; VersionType: 'SpecificVersion'; Version: '1.0.1-PREv007'; Prerelease: 'True'; Repository: 'AzureTestRepo'; AcceptLicense: 'False'; Quiet: 'False'; Reinstall: 'True'; TrustRepository: 'False'; NoClobber: 'False'; AsNupkg: 'False'; IncludeXml 'False'; SavePackage 'True'; TemporaryPath ''; SkipDependencyCheck: 'False'; AuthenticodeCheck: 'False'; PathsToInstallPkg: 'C:\temp'; Scope ''
DEBUG: In InstallHelper::ProcessRepositories()
VERBOSE: credential successfully read from vault and set for repository: AzureTestRepo
VERBOSE: Attempting to search for packages in 'AzureTestRepo'
WARNING: Installing dependencies is not currently supported for V3 server protocol repositories. The package will be installed without installing dependencies.
Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): y
DEBUG: In InstallHelper::InstallPackages()
DEBUG: In InstallHelper::InstallPackage()
DEBUG: In V3ServerAPICalls::FindVersion()
DEBUG: In V3ServerAPICalls::FindVersionHelper()
DEBUG: 'AzureDevopstest' version parsed as '1.0.1-PREv007'
DEBUG: In V3ServerAPICalls::GetVersionedPackageEntriesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::GetResourcesFromServiceIndex()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pkgs.dev.azure.com/{redacted}/_packaging/TestFeed/nuget/v3/index.json'
DEBUG: In V3ServerAPICalls::FindRegistrationsBaseUrl()
DEBUG: In V3ServerAPICalls::GetVersionedResponsesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pkgs.dev.azure.com/{redacted}/nuget/v3/registrations2-semver2/azuredevopstest/index.json'
DEBUG: In V3ServerAPICalls::GetMetadataElementsFromResponse()
DEBUG: In V3ServerAPICalls::GetMetadataElementFromItemsElement()
DEBUG: In V3ServerAPICalls::IsLatestVersionFirstForSearch()
Confirm
Are you sure you want to perform this action?
Performing the operation "Save-PSResource" on target "Package to save: 'AzureDevopsTest', version: '1.0.1-PREv007'".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
Confirm
Are you sure you want to perform this action?
Performing the operation "Save-PSResource" on target "Package to install: 'AzureDevopsTest', version: '1.0.1-PREv007'".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
DEBUG: In V3ServerAPICalls::InstallPackage()
DEBUG: In V3ServerAPICalls::InstallVersion()
DEBUG: In V3ServerAPICalls::InstallHelper()
DEBUG: In V3ServerAPICalls::GetVersionedPackageEntriesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::GetResourcesFromServiceIndex()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pkgs.dev.azure.com/{redacted}/_packaging/TestFeed/nuget/v3/index.json'
DEBUG: In V3ServerAPICalls::FindRegistrationsBaseUrl()
DEBUG: In V3ServerAPICalls::GetVersionedResponsesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pkgs.dev.azure.com/{redacted}/nuget/v3/registrations2-semver2/azuredevopstest/index.json'
DEBUG: In V3ServerAPICalls::GetMetadataElementsFromResponse()
DEBUG: In V3ServerAPICalls::GetMetadataElementFromItemsElement()
DEBUG: In V3ServerAPICalls::IsLatestVersionFirstForInstall()
VERBOSE: Attempting to delete 'C:\Users\adria\AppData\Local\Temp\62a69787-9390-4295-b929-9652e33f5c35'
VERBOSE: Successfully deleted 'C:\Users\adria\AppData\Local\Temp\62a69787-9390-4295-b929-9652e33f5c35'
Save-PSResource: Package with name 'AzureDevopsTest' and version '1.0.1-PREv007' could not be found in repository 'AzureTestRepo'
Error details
PSMessageDetails :
Exception : System.Exception: Package with name 'AzureDevopsTest' and version '1.0.1-PREv007' could not be found in repository 'AzureTestRepo'
TargetObject : Microsoft.PowerShell.PSResourceGet.Cmdlets.V3ServerAPICalls
CategoryInfo : InvalidResult: (Microsoft.PowerShel…ts.V3ServerAPICalls:V3ServerAPICalls) [Save-PSResource], Exception
FullyQualifiedErrorId : InstallFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.SavePSResource
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
Environment data
$PSVersionTable
Name Value
---- -----
PSVersion 7.4.6
PSEdition Core
GitCommitId 7.4.6
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Find-PSResource 1.1.0 Microsoft.PowerShell.PSResourceGet
Name Uri Trusted Priority IsAllowedByPolicy
---- --- ------- -------- -----------------
AzureTestRepo https://pkgs.dev.azure.com/{redacted}/_packaging/TestFeed/nuget/v3/index.json True 50 True
ghpackagetest2 https://nuget.pkg.github.com/{redacted}/index.json False 50 True
PSGallery https://www.powershellgallery.com/api/v2 False 50 True
Visuals
No response