Error loading a nuget package in power shell.

Lucía Sánchez 45 Reputation points
2023-05-11T08:40:48.1633333+00:00
Hi, I'm trying to load the Azure.DigitalTwins.Core -Version 1.4.0 package in azure cloud shell (power shell) and I'm getting the following error. 
How can I solve it?


PS /home/p82salul/LocalFunctionProj> dotnet add package Microsoft.Azure.DigitalTwins.Core --version 1.4.0                                          Determining projects to restore...
  Writing /tmp/tmps90Rbs.tmp
info : X.509 certificate chain validation will use the fallback certificate bundle at '/usr/share/dotnet/sdk/6.0.408/trustedroots/codesignctl.pem'.
info : Adding PackageReference for package 'Microsoft.Azure.DigitalTwins.Core' into project '/home/p82salul/LocalFunctionProj/LocalFunctionProj.csproj'.
info : Restoring packages for /home/p82salul/LocalFunctionProj/LocalFunctionProj.csproj...
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.azure.digitaltwins.core/index.json
info :   GET https://www.nuget.org/packages/Azure.DigitalTwins.Core/FindPackagesById()?id='Microsoft.Azure.DigitalTwins.Core'&semVerLevel=2.0.0
info :   NotFound https://api.nuget.org/v3-flatcontainer/microsoft.azure.digitaltwins.core/index.json 377ms
info :   NotFound https://www.nuget.org/packages/Azure.DigitalTwins.Core/FindPackagesById()?id='Microsoft.Azure.DigitalTwins.Core'&semVerLevel=2.0.0 469ms
log  : Retrying 'FindPackagesByIdAsyncCore' for source 'https://www.nuget.org/packages/Azure.DigitalTwins.Core/FindPackagesById()?id='Microsoft.Azure.DigitalTwins.Core'&semVerLevel=2.0.0'.
log  : Response status code does not indicate success: 404 (Not Found).
info :   GET https://www.nuget.org/packages/Azure.DigitalTwins.Core/FindPackagesById()?id='Microsoft.Azure.DigitalTwins.Core'&semVerLevel=2.0.0
info :   NotFound https://www.nuget.org/packages/Azure.DigitalTwins.Core/FindPackagesById()?id='Microsoft.Azure.DigitalTwins.Core'&semVerLevel=2.0.0 40ms
log  : Retrying 'FindPackagesByIdAsyncCore' for source 'https://www.nuget.org/packages/Azure.DigitalTwins.Core/FindPackagesById()?id='Microsoft.Azure.DigitalTwins.Core'&semVerLevel=2.0.0'.
log  : Response status code does not indicate success: 404 (Not Found).
info :   GET https://www.nuget.org/packages/Azure.DigitalTwins.Core/FindPackagesById()?id='Microsoft.Azure.DigitalTwins.Core'&semVerLevel=2.0.0
info :   NotFound https://www.nuget.org/packages/Azure.DigitalTwins.Core/FindPackagesById()?id='Microsoft.Azure.DigitalTwins.Core'&semVerLevel=2.0.0 37ms
error: NU1301: Failed to retrieve information about 'Microsoft.Azure.DigitalTwins.Core' from remote source 'https://www.nuget.org/packages/Azure.DigitalTwins.Core/FindPackagesById()?id='Microsoft.Azure.DigitalTwins.Core'&semVerLevel=2.0.0'.
info : Package 'Microsoft.Azure.DigitalTwins.Core' is compatible with all the specified frameworks in project '/home/p82salul/LocalFunctionProj/LocalFunctionProj.csproj'.
error: Value cannot be null. (Parameter 'version')


Usage: NuGet.CommandLine.XPlat.dll package add [options]

Options:
  -h|--help               Show help information
  --force-english-output  Forces the application to run using an invariant, English-based culture.
  --package               Id of the package to be added.
  --version               Version of the package to be added.
  -d|--dg-file            Path to the dependency graph file to be used to restore preview and compatibility check.
  -p|--project            Path to the project file.
  -f|--framework          Frameworks for which the package reference should be added.
  -n|--no-restore         Do not perform restore preview and compatibility check. The added package reference will be unconditional.
  -s|--source             Specifies NuGet package sources to use during the restore.
  --package-directory     Directory to restore packages in.
  --interactive           Allow the command to block and require manual action for operations like authentication.
  --prerelease            Allows prerelease packages to be installed.


PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,306 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Rich Matheisen 45,756 Reputation points
    2023-05-15T15:18:09.13+00:00

    Is the version of .NET Core on your machine one of the versions supported by the package?

    "dotnet --version" will show you the information.

    Otherwise it's time to use that "contact owner" link.

    You might also try asking the question over on https://stackoverflow.com

    1 person found this answer helpful.
    0 comments No comments

  2. Rich Matheisen 45,756 Reputation points
    2023-05-11T15:03:39.0266667+00:00

    The error says that the URL leads to a non-existent page (404 (Not Found)) -- and both URLs result in the same error.

    However, from the NuGet site (https://www.nuget.org/packages/Azure.DigitalTwins.Core) you can download the package. You should be able to install it from the downloaded file.

    Have you logged on to the NuGet site and used the "Contact owners" link?

    0 comments No comments

  3. Lucía Sánchez 45 Reputation points
    2023-05-15T07:55:26.8333333+00:00

    I downloaded the package from the link you gave me. But when I put the command it still gets the link to the page that does not exist.

    0 comments No comments