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 Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. pico nazzaro 211 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)

    42 people found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.