首先,我感谢您的光临,我希望即使英语破译,您也能理解我:
无法加载类型 'Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptionsExtensionWithDebugInfo' 来自程序集'Microsoft.EntityFrameworkCore,Version = 3.0.0.0, 文化=中性,PublicKeyToken = adb9793829ddae60'
试图重新安装所有软件包,手动放置引用,重新启动PC,重新启动VS2019甚至开始新项目,但仍然存在错误。
我去过here,但没有帮助。
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(
Configuration.GetConnectionString("DefaultConnection")));
-。csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UserSecretsId>aspnet-ZavrsniRad01-F04B6A7E-6450-4254-8092-F42843F4615A</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.0.0-preview6.19307.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0-preview6.19307.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.0.0-preview6.19307.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview.18572.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0-preview6.19304.10" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0-preview6.19304.6" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0-preview6-19319-03" />
</ItemGroup>
</Project>
答案 0 :(得分:0)
显然,我必须安装EntityFrameworkCore.SqlServer Preview6才能解决此错误
Install-Package Microsoft.EntityFrameworkCore.SqlServer -Version 3.0.0-preview6.19304.10
答案 1 :(得分:0)
我也有此错误消息,但根本原因是缺少与延迟加载相关的代理程序包。安装Microsoft.EntityFrameworkCore.Proxies为我解决了这个问题:
Install-Package Microsoft.EntityFrameworkCore.Proxies -Version 3.1.8
答案 2 :(得分:0)