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

Cannot convert value 'PSDepend.Format.ps1xml' to type 'System.Version'. #135

Open
justinainsworth opened this issue Nov 29, 2021 · 0 comments

Comments

@justinainsworth
Copy link

justinainsworth commented Nov 29, 2021

I am working on an azure devops pipeline, and utilizing PSDepend to prefetch build dependencies on a self hosted build environment.

I have noticed that when invoke-psdepend is called using an input object (using the installimport-hashtable parameter set), it is failing with the following error:
Cannot convert value 'PSDepend.Format.ps1xml' to type 'System.Version'

Error Record and stack trace below:
System.ArgumentException: Cannot convert value 'PSDepend.Format.ps1xml' to type 'System.Version'.
at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
TargetObject: PSDepend.Format.ps1xml
CategoryInfo: InvalidArgument: (PSDepend.Format.ps1xml:String) [Validate-VersionParameters], ArgumentException
FullyQualifiedErrorId: InvalidVersion,Validate-VersionParameters
InvocationInfo: System.Management.Automation.InvocationInfo
ParameterValues: System.Collections.Hashtable
MyCommand: Validate-VersionParameters
BoundParameters: System.Collections.Generic.Dictionary2[System.String,System.Object] UnboundArguments: ScriptLineNumber: 9688 OffsetInLine: 33 HistoryId: 1 ScriptName: C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1 Line: $ValidationResult = Validate-VersionParameters -CallerPSCmdlet $PSCmdlet
PositionMessage: At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:9688 char:33
'+ ... dationResult = Validate-VersionParameters -CallerPSCmdlet $PSCmdlet `
'+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PSScriptRoot: C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5
PSCommandPath: C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1
InvocationName: Validate-VersionParameters
PipelineLength: 0
PipelinePosition: 0
ExpectingInput: False
CommandOrigin: Internal
DisplayScriptPosition:
ScriptStackTrace: at ThrowError, C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1: line 7115

at ValidateAndGet-VersionPrereleaseStrings, C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1: line 8360

at Validate-VersionParameters, C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1: line 7444

at Install-Module, C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1: line 9688

at , C:\Program Files\WindowsPowerShell\Modules\PSDepend\0.3.8\PSDependScripts\PSGalleryModule.ps1: line 302

at Invoke-DependencyScript, C:\Program Files\WindowsPowerShell\Modules\PSDepend\0.3.8\Public\Invoke-DependencyScript.ps1: line 195

at Invoke-PSDepend, C:\Program Files\WindowsPowerShell\Modules\PSDepend\0.3.8\Public\Invoke-PSDepend.ps1: line 295

I ran invoke-psdepend in verbose mode, and got this additional output:

VERBOSE: Processed the dependency 'FormatsToProcess'
VERBOSE: Running Invoke-DependencyScript with ParameterSetName 'Map' and params:
Key Value
'--- -----
PSDependAction {Install, Import}
PSDependTypePath C:\Program Files\WindowsPowerShell\Modules\PSDepend\0.3.8\PSDependMap.psd1
Dependency @{DependencyFile=Hashtable; DependencyName=FormatsToProcess; DependencyType=PSGalleryModule;
Name=F...

VERBOSE: Dependencies:

DependencyFile : Hashtable
DependencyName : FormatsToProcess
DependencyType : PSGalleryModule
Name : FormatsToProcess
Version : PSDepend.Format.ps1xml
Parameters :
Source :
Target :
AddToPath :
Tags :
DependsOn :
PreScripts :
PostScripts :
Credential :
PSDependOptions :
Raw :

VERBOSE: Searching for C:\Program Files\WindowsPowerShell\Modules\PSDepend\0.3.8\PSDependScripts\PSGalleryModule.ps1
VERBOSE: Searching for PSGalleryModule.ps1
VERBOSE: Get-Parameters for C:\Program
Files\WindowsPowerShell\Modules\PSDepend\0.3.8\PSDependScripts\PSGalleryModule.ps1\PSGalleryModule.ps1
VERBOSE: Found parameters [AcceptLicense AllowClobber AllowPrerelease Dependency Import PSDependAction Repository
SkipPublisherCheck]
VERBOSE: Invoking 'C:\Program Files\WindowsPowerShell\Modules\PSDepend\0.3.8\PSDependScripts\PSGalleryModule.ps1' with
parameters

Name Value

'---- -----

Dependency @{DependencyFile=Hashtable; DependencyName=FormatsToProcess;
DependencyType=PSGallery...
PSDependAction {Install, Import}

VERBOSE: Getting dependency [FormatsToProcess] from PowerShell repository [PSGallery]
VERBOSE: Installing [FormatsToProcess] with scope [AllUsers]

Any ideas on what is going on here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant