参考类型' IListSource'声称它是在'系统'中定义的,但无法找到它

时间:2017-02-27 03:59:59

标签: c# asp.net-core .net-framework-version

我尝试添加我的目标框架.Net Framework 4.5已添加Microsoft.NETCore.Portable.Compatibility": "1.0.1"以修复mscorlib error

以下是project.json

"dependencies": {
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Routing": "1.0.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Swashbuckle": "6.0.0-beta902",
    "Microsoft.AspNetCore.Cors": "1.1.0",
    "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
    "Microsoft.EntityFrameworkCore": "1.0.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0"
},

"tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},

"frameworks": {
    "netcoreapp1.0": {
        "dependencies": {
            "Microsoft.NETCore.App": {
                "version": "1.0.1",
                "type": "platform"
            },
            "Clemittance.Database.ReadModel": "1.9.5"
        },
        "imports": [
            "dotnet5.6",
            "portable-net45+win8",
            "net45",
            "dnxcore50"
        ]
    }
},

Clemittance.Database.ReadModel是我的包裹

错误 enter image description here

enter image description here

1 个答案:

答案 0 :(得分:1)

首先,从导入部分删除net45,您不应该以这种方式滥用它。您只能在此处使用.NET Core兼容框架,例如portable-net45+win8,它们可以与.NET Core一起使用,因为它们共享相同的API表面。

绝对不要使用imports。它只是强制nuget恢复某些nuget包,它们还没有像netstandard1.x那样定位,就像某些可移植类库(PCL)一样。

滥用它除了其他任何东西,都行不通。您无法使.NET Framework 4.x库自动与.NET Core一起使用。

IListSource似乎是.NET Core的一部分,而不是“核心”.NET Core包的一部分。但是,packagesearch表示它位于SystemSystem.ComponentModel.TypeConverter包中(请参阅http://packagesearch.azurewebsites.net/?q=IListSource)。