Home > Software design >  The Visual Studio can't find Entity Framework
The Visual Studio can't find Entity Framework

Time:10-15

I have created a new MVC Web App project in the Visual Studio 2019 (Targeting .NET 5.0)

Now I want to install EntityFrameworkCore, but it doesn't appear on the list when I search in the NuGet manager. If I type "entity", only 3 options appear. If I type more than that, nothing more appears.

enter image description here

I also tried typing (in the console manager)

Install-Package Microsoft.EntityFrameworkCore -Version 5.0.11

and getting this error:

    `Install-Package : NU1101: Unable to find package` 
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packag
    es
    At line:1 char:1
      Install-Package Microsoft.EntityFrameworkCore -Version 5.0.11
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
          FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

I also tried cleaning and building the project several times. The VS2019 I recently just installed. What might be wrong?

CodePudding user response:

In the Visual Studio go to ToolsOptions. Select NuGet Package Manager. Check that you have Package sources: is including nuget.org set to https://api.nuget.org/v3/index.json:

enter image description here

Then ToolsNuGet Package ManagerManage NuGet Packages for Solution.... Open the Browse tab.

Select nuget.org in the Package source: combo-box:

enter image description here

  • Related