无法加载类型 [英] Could not load type

查看:55
本文介绍了无法加载类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我感谢您的光临,我希望即使英语破译,您也能理解我:

First of all i thank you on your time and i hope that you can understand me even with English as broken as this one:

无法加载类型'Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptionsExtensionWithDebugInfo'来自程序集'Microsoft.EntityFrameworkCore,Version = 3.0.0.0,文化=中性,PublicKeyToken = adb9793829ddae60'

Could not load type 'Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptionsExtensionWithDebugInfo' from assembly 'Microsoft.EntityFrameworkCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'

试图重新安装所有软件包,手动放置引用,重新启动PC,重新启动VS2019,甚至启动了新项目,但仍然存在错误.

Tried to reinstall all packages, to manually put references, restarted PC,restarted VS2019 and even started new project but still error is there again.

我一直此处但这没有帮助.

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>

推荐答案

显然,我必须安装EntityFrameworkCore.SqlServer Preview6才能解决此错误

Apparently i had to install EntityFrameworkCore.SqlServer preview6 to solve this error

Install-Package Microsoft.EntityFrameworkCore.SqlServer -Version 3.0.0-preview6.19304.10

这篇关于无法加载类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆