There are no versions available for the package

41486451 11 Reputation points
2021-04-29T15:48:41.547+00:00

I am currently doing the Create .NET Core console application challenge. I am using v5.0.102 of the .NET 5 SDK.
Below is the process for adding a Graph Console App -
Step 2 adding a package creates the following process and error as below. When I add a version no it gives another
error: NU1101: Unable to find package Microsoft.Identity.Client. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages
error: Package 'Microsoft.Identity.Client' is incompatible with 'all' frameworks in project.

c:\LearnMS365>dotnet new console -o graphconsoleapp
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on graphconsoleapp\graphconsoleapp.csproj...
Determining projects to restore...
Restored c:\LearnMS365\graphconsoleapp\graphconsoleapp.csproj (in 94 ms).
Restore succeeded.

c:\LearnMS365>cd graphconsoleapp

c:\LearnMS365\graphconsoleapp>dotnet add package Microsoft.Identity.Client
Determining projects to restore...
Writing C:\Users\Admin\AppData\Local\Temp\tmp6B87.tmp
info : Adding PackageReference for package 'Microsoft.Identity.Client' into project 'c:\LearnMS365\graphconsoleapp\graphconsoleapp.csproj'.
error: There are no versions available for the package 'Microsoft.Identity.Client'.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,710 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,650 questions
{count} votes

1 answer

Sort by: Most helpful
  1. pico nazzaro 156 Reputation points
    2021-06-23T16:50:05.903+00:00

    this fixed it for me:

    dotnet nuget add source --name nuget.org https://api.nuget.org/v3/index.json

    https://stackoverflow.com/questions/67284397/c-sharp-dotnet-cli-error-there-are-no-versions-available-for-the-package-newt?newreg=7c8ebdca5897431e9d45030b4d05f2b8

    apparently it's a missing step from the Exercise to add a nuget source or assumes the user has Visual Studio installed (not sure if that would do it either); it is not indicated in the prerequisites for the Exercise:

    .NET SDK - v5.* (or higher)
    Visual Studio Code

    I have both installed and it still failed until I ran the command above to set the nuget source.

    https://learn.microsoft.com/en-us/learn/modules/optimize-data-usage/3-exercise-retrieve-control-information-returned-from-microsoft-graph)

    31 people found this answer helpful.