question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update-PSResource fails with required nuget version

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 months ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ThomasNietocommented, Jul 31, 2023

@SydneyhSmith feel free to compare to my tests for anypackage/psresourceget to see if there are any gaps.

1reaction
SydneyhSmithcommented, Jul 31, 2023

Thanks @ThomasNieto, we should also check our tests, as a test should have caught this regression

Read more comments on GitHub >

github_iconTop Results From Across the Web

visual studio 2015 - Trying to update Nuget Package fails
According to the error message, your problem occurs when retrieving package metadata from the url, you need to check the package source from ......
Read more >
Troubleshooting NuGet Package Restore in Visual Studio
This error occurs when you attempt to build a project that contains references to one or more NuGet packages, but those packages are...
Read more >
Unable to resolve dependencies of NuGet packages
Solution · Clear the NuGet cache files. You do this in the following way: In the toolbar of Visual Studio, navigate to Tools...
Read more >
NuGet Error NU1102
Solution. Edit the project file to correct the package version. Check your NuGet.Config for the PackageSourceMapping configuration. The package ...
Read more >
NuGet packages in the Package Registry
Publish NuGet packages in your project's Package Registry. Then, install the packages whenever you need to use them as a dependency. The Package...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found