Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Some version numbers are taken into account without respecting the PowershellGet versioning standard. #691

@LaurentDardenne

Description

@LaurentDardenne

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

These version numbers are considered valid without respecting the PowershellGet versioning standard.

   '1.0-',
   '1.2-',
   '1.2--'
   '1.2.3-',
   '1.2.3--',
   '1.2.3.4-',
   '1.2.3.4--'

   #[version]'1.0.-1' throw an exception
   #[version]'0.0.-0' OK, return 0.0.0.-1

Their use does not trigger a syntax error but returns 'NoMatchFoundForCriteria'.

Expected behavior

Install-Module PowerShellGet  -RequiredVersion '1.2.3-beta-' -AllowPrerelease
Validate-VersionParameters : The Prerelease string 'beta-' contains invalid characters. Please ensure that only
characters 'a-zA-Z0-9' and possibly hyphen ('-') at the beginning are in the Prerelease string.

Actual behavior

Install-Module PowerShellGet  -RequiredVersion '1.2.3--' -AllowPrerelease
PackageManagement\Install-Package : No match was found for the specified search criteria and module name
'PowerShellGet'. Try Get-PSRepository to see all available registered module repositories.

Install-Module PowerShellGet  -RequiredVersion '1.2.3-beta-' -AllowPrerelease
Validate-VersionParameters : The Prerelease string 'beta-' contains invalid characters. Please ensure that only
characters 'a-zA-Z0-9' and possibly hyphen ('-') at the beginning are in the Prerelease string.
Au caractère C:\Users\Laurent\Documents\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:9688 : 33
+ ... dationResult = Validate-VersionParameters -CallerPSCmdlet $PSCmdlet `
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation : (beta-:String) [Validate-VersionParameters], ArgumentException
    + FullyQualifiedErrorId : InvalidCharactersInPrereleaseString,Validate-VersionParameters

Impossible d’extraire la variable « $ValidationResult », car elle n’a pas été définie.
Au caractère C:\Users\Laurent\Documents\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:9696 : 22
+             if (-not $ValidationResult) {
+                      ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation : (ValidationResult:String) [], RuntimeException
    + FullyQualifiedErrorId : VariableIsUndefined

PackageManagement\Install-Package : No match was found for the specified search criteria and module name
'PowerShellGet'. Try Get-PSRepository to see all available registered module repositories.
Au caractère C:\Users\Laurent\Documents\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:9711 : 34
+ ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex
   ception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Error details

get-error

get-error : Le terme «get-error» n'est pas reconnu comme nom d'applet de commande, fonction, fichier de script ou
programme exécutable. Vérifiez l'orthographe du nom, ou si un chemin d'accès existe, vérifiez que le chemin d'accès est correct et réessayez.


### Environment data

```PowerShell
$psversiontable

Name                           Value
----                           -----
PSVersion                      5.1.19041.2364
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.19041.2364}
BuildVersion                   10.0.19041.2364
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


### Version

5.1

### Visuals


![image](https://user-images.githubusercontent.com/4894452/212126176-55ae83a5-2ba0-4fd6-8a32-6b99423c1cd3.png)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions