小编hxw*_*tch的帖子

找不到类型或命名空间名称"OpenIddictDbContext <,,>"

我有个问题.我今天早上打开了我的项目并得到了错误:

找不到类型或命名空间名称'OpenIddictDbContext <,,>'(您是否缺少using指令或程序集引用?)[netcoreapp1.1]

我恢复并构建项目时发生此错误.这很奇怪,因为我在我的project.json文件中有"OpenIddict":"1.0.0-*",我正在使用引用:using OpenIddict ;

这个问题在我的项目中到处都会出现问题,因为他似乎没有认识到"使用OpenIddict"

如果它有帮助,这是我得到错误的例子(ApplicationDbContext.cs)

 namespace Overnight.Db
{
    //the error: The type or namespace name 'OpenIddictDbContext<,,>' could not be found (are you missing a using directive or an assembly reference?)

    public class ApplicationDbContext : OpenIddictDbContext<ApplicationUser, ApplicationRole, Guid>
    {
Run Code Online (Sandbox Code Playgroud)

要么

 //the error: 'OpenIddictDbContext<ApplicationUser, ApplicationRole, Guid>' does not contain a constructor that takes 1 arguments

        protected override void OnModelCreating(ModelBuilder builder)
        {
Run Code Online (Sandbox Code Playgroud)

这是我的project.json:

{
  "version": "1.0.0-*",
  "buildOptions": {
      "emitEntryPoint": true
  },
  "dependencies": {
    "Microsoft.NETCore.App": {
      "type": "platform", …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc visual-studio asp.net-core openiddict

4
推荐指数
1
解决办法
1842
查看次数