' EntityFramework.Core,Version = 7.0.0.0,使用' System.Linq.Expressions,Version = 4.0.11.0

时间:2015-11-20 20:34:38

标签: c# linq asp.net-core entity-framework-core

我有一个包含三个项目的ASP.NET 5.0解决方案

  1. MVC项目
  2. 数据访问项目
  3. 实体定义
  4. 尝试将项目从ASP.NET 5和EF 7的beta-8升级到RC1-final后,我得到以下错误(在我看过的任何地方都没有产生任何内容)。

    ****错误: 错误CS1705汇编' EntityFramework.Core' with identity' EntityFramework.Core,Version = 7.0.0.0,Culture = neutral,PublicKeyToken = adb9793829ddae60'使用' System.Linq.Expressions,Version = 4.0.11.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'它的版本高于引用的汇编版本System.Linq.Expressions' with identity' System.Linq.Expressions,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a' ASS.DomainDataModel ****

    我尝试通过软件包管理器控制台加载不同版本的System.Linq,针对所有三个项目,并从所有项目的project.json文件中删除System.Linq并将其重新添加,尝试不同的版本。我试图解决这个问题的时间越长,我越来越困惑。我想我错过了一些非常明显的东西......

    正如所建议的,这里是三个project.json文件的内容

    MVC项目:

    {
      "webroot": "wwwroot",
      "version": "1.0.0-*",
    
      "dependencies": {
        "Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
        "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
        "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
        "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
        "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
        "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
        "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
        "System.Linq.Parallel": "4.0.1-beta-23516", 
        "ASS.DomainClasses": "1.0.0-*",
        "ASS.DomainDataModel": "1.0.0-*"
      },
    
      "commands": {
        "web": "Microsoft.AspNet.Server.Kestrel",
        "ef": "EntityFramework.Commands"
      },
    
      "frameworks": {
        "dnx451": {
          "dependencies": {
            "System.Linq.Expressions": "4.0.11-beta-23516"
          }
        },
        "dnxcore50": {
          "dependencies": {
            "System.Linq.Expressions": "4.0.10"
          }
        }
      },
    
      "exclude": [
        "wwwroot",
        "node_modules",
        "bower_components"
      ],
      "publishExclude": [
        "node_modules",
        "bower_components",
        "**.xproj",
        "**.user",
        "**.vspscc"
      ]
    }
    

    数据访问项目:

    {
      "version": "1.0.0-*",
      "description": "ASS.DomainDataModel Class Library",
      "tags": [ "" ],
      "projectUrl": "",
      "licenseUrl": "",
    
      "frameworks": {
        "dnx451": {
          "dependencies": {
            "System.Linq.Expressions": "4.0.11-beta-23516"
          }
        },
        "dnxcore50": {
          "dependencies": {
          }
        }
      },
    
      "dependencies": {
        "ASS.DomainClasses": "1.0.0-*",
        "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc1-final",
        "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc1-final",
        "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc1-final",
        "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
        "EntityFramework.Core": "7.0.0-rc1-final",
        "EntityFramework.Commands": "7.0.0-rc1-final",
        "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
        "EntityFramework.Relational": "7.0.0-rc1-final"
      },
    
        "commands": {
        "ef": "EntityFramework.Commands"
      }
    }
    

    实体def项目:

    {
      "version": "1.0.0-*",
      "description": "ASS.DomainClasses Class Library",
      "tags": [ "" ],
      "projectUrl": "",
      "licenseUrl": "",
    
      "frameworks": {
        "dnx451": {
          "dependencies": {
            "System.Linq.Expressions": "4.0.11-beta-23516"
          }
        },
        "dnxcore50": {
          "dependencies": {
            "Microsoft.CSharp": "4.0.1-beta-23516",
            "System.Collections": "4.0.11-beta-23516",
            "System.Linq.Expressions": "4.0.10",
            "System.Runtime": "4.0.21-beta-23516",
            "System.Threading": "4.0.11-beta-23516"
          }
        }
      }
    }
    

1 个答案:

答案 0 :(得分:1)

project.json中"dependencies""frameworkAssemblies"之间存在细微差别。您的"dnx451"框架正在使用System.Linq.Expressions的打包版本。您更有可能需要指定框架程序集。 (猜猜我不知道你的项目的确切要求。)

请参阅{{3}}

此外,这可能是由于ASS.DomainDataModel中的不兼容性。