Skip to content

Update-PSResource fails with required nuget version #1311

@ThomasNieto

Description

@ThomasNieto

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

If you try and Update-PSResource using a nuget version syntax it fails, Install-PSResource works. This workflow worked in beta22 so something has changed to break it.

I found this while running CI for my module: CI run

PS C:\Users\Thomas> Install-PSResource -Name NetworkingDsc -Version '[8.0.0]' -PassThru

Name          Version Prerelease Repository Description
----          ------- ---------- ---------- -----------
NetworkingDsc 8.0.0              PSGallery  DSC resources for configuring settings related to networking.

PS C:\Users\Thomas> Update-PSResource -Name NetworkingDsc -Version '[8.1.0]' -PassThru

Name          Version Prerelease Repository Description
----          ------- ---------- ---------- -----------
NetworkingDsc 8.1.0              PSGallery  DSC resources for configuring settings related to networking.

PS C:\Users\Thomas> Update-PSResource -Name NetworkingDsc -Version '[8.2.0-preview0001]' -PassThru
Update-PSResource: Package 'NetworkingDsc' with version '[8.2.0-preview0001]' could not be found
WARNING: Installed package 'NetworkingDsc':'[8.2.0-preview0001]' was not found in repositories and cannot be updated.

PS C:\Users\Thomas> Update-PSResource -Name NetworkingDsc -Version '[8.2.0-preview0001]' -PassThru -Prerelease
Update-PSResource: Package 'NetworkingDsc' with version '[8.2.0-preview0001]' could not be found
WARNING: Installed package 'NetworkingDsc':'[8.2.0-preview0001]' was not found in repositories and cannot be updated.

Expected behavior

# works

Actual behavior

Update-PSResource -Name NetworkingDsc -Version '[8.2.0-preview0001]' -PassThru -Prerelease
Update-PSResource: Package 'NetworkingDsc' with version '[8.2.0-preview0001]' could not be found
WARNING: Installed package 'NetworkingDsc':'[8.2.0-preview0001]' was not found in repositories and cannot be updated.

Error details

Exception             :
    Type           : Microsoft.PowerShell.PSResourceGet.UtilClasses.PackageNotFoundException
    Message        : Package 'NetworkingDsc' with version '[8.2.0-preview0001]' could not be found
    InnerException :
        Type    : Microsoft.PowerShell.PSResourceGet.UtilClasses.V2ResourceNotFoundException
        Message : Package does not exist on the server
        HResult : -2146233088
    HResult        : -2146233088
TargetObject          : Microsoft.PowerShell.PSResourceGet.Cmdlets.FindHelper
CategoryInfo          : InvalidResult: (Microsoft.PowerShel….Cmdlets.FindHelper:FindHelper) [Update-PSResource],
PackageNotFoundException
FullyQualifiedErrorId : FindNameConvertToPSResourceFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.UpdatePSResource
InvocationInfo        :
    MyCommand        : Update-PSResource
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 4
    Line             : Update-PSResource -Name NetworkingDsc -Version '[8.2.0-preview0001]' -PassThru -Prerelease
    Statement        : Update-PSResource -Name NetworkingDsc -Version '[8.2.0-preview0001]' -PassThru -Prerelease
    PositionMessage  : At line:1 char:1
                       + Update-PSResource -Name NetworkingDsc -Version '[8.2.0-preview0001]'  …
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Update-PSResource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :

Environment data

beta23

Visuals

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions