1

I don't know why, but EntityFramework Core has completely vanished for me. It's gone from the Microsoft namespace and does not exist anywhere in the NuGet package browser or even the dotnet CLI direct install.

I tried fully uninstalling and reinstalling visual studio and all associated tools. I've tried reloading the project. I've tried directly injecting it into the csproj file:

<ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.3">
        <PrivateAssets>all</PrivateAssets>
        <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.3">
        <PrivateAssets>all</PrivateAssets>
        <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
</ItemGroup>

Even when I directly copy and past the dotnet CLI command found here (https://www.nuget.org/packages/Microsoft.EntityFrameworkCore) it just doesn't exist.

dotnet:

PS C:\Users\nikkolas\Documents\Nikkolas Diehl\Work\TestAPI> dotnet add package Microsoft.EntityFrameworkCore --version 5.0.6
  Determining projects to restore...
  Writing C:\Users\nikkolas\AppData\Local\Temp\tmp9036.tmp
info : Adding PackageReference for package 'Microsoft.EntityFrameworkCore' into project 'C:\Users\nikkolas\Documents\Nikkolas Diehl\Work\TestAPI\TestAPI.csproj'.
info : Restoring packages for C:\Users\nikkolas\Documents\Nikkolas Diehl\Work\TestAPI\TestAPI.csproj...
error: NU1101: Unable to find package Microsoft.EntityFrameworkCore. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages
error: NU1101: Unable to find package Microsoft.EntityFrameworkCore.Design. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages
error: NU1101: Unable to find package Microsoft.EntityFrameworkCore.SqlServer. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages
error: NU1101: Unable to find package Microsoft.EntityFrameworkCore.Tools. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages
error: Package 'Microsoft.EntityFrameworkCore' is incompatible with 'all' frameworks in project 'C:\Users\nikkolas\Documents\Nikkolas Diehl\Work\TestAPI\TestAPI.csproj'.

PM:

Install-Package : Failed to retrieve information about 'Microsoft.EntityFrameworkCore.SqlServer' from remote source 'https://www.nuget.org/FindPackagesById()?id='Microsoft.EntityFrameworkCore.SqlServer'&semVerLevel=2.0.0'.
  Response status code does not indicate success: 404 (Not Found).
At line:1 char:1
+ Install-Package Microsoft.EntityFrameworkCore -Version 5.0.6
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
 
Time Elapsed: 00:00:03.0365187
Aquaphor
  • 129
  • 10

1 Answers1

2

Ok, so I found the answer. Turns out that some how my installation of Visual Studio did not properly set up NuGet's Package Source control. So I had to manually link it with the correct source: https://api.nuget.org/v3/index.json

Aquaphor
  • 129
  • 10
  • 3
    For someone who's wondering how to apply this answer, Go to Visual Studio > Tools > Nuget Package Manager > Package Manager Settings > Nuget Package Manager:Package Sources > Click Add Icon > paste https://api.nuget.org/v3/index.json to Source Field > Click OK – Ron Michael Dec 07 '21 at 10:35
  • @RonMichael should turn this into an answer so I can upvote it – Clintm Apr 05 '23 at 20:14