.net 由于某些原因,EntityFramework核心在任何地方都不存在

.net 由于某些原因,EntityFramework核心在任何地方都不存在,.net,entity-framework-core,nuget-package,.net,Entity Framework Core,Nuget Package,我不知道为什么,但EntityFramework核心对我来说已经完全消失了。 它来自Microsoft命名空间,在NuGet软件包浏览器甚至dotnet CLI直接安装中都不存在 我尝试完全卸载并重新安装visual studio和所有相关工具。我试着重新加载这个项目。我已尝试将其直接注入csproj文件: <ItemGroup> <PackageReference Include="Microsoft.EntityFrameworkCore" Ve

我不知道为什么,但EntityFramework核心对我来说已经完全消失了。 它来自Microsoft命名空间,在NuGet软件包浏览器甚至dotnet CLI直接安装中都不存在

我尝试完全卸载并重新安装visual studio和所有相关工具。我试着重新加载这个项目。我已尝试将其直接注入csproj文件:

<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>
下午:

好的,我找到了答案。 事实证明,我的VisualStudio安装没有正确设置NuGet的包源代码控制。 因此,我必须手动将其与正确的源链接:

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'.
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