jayvee
jayvee

Reputation: 160

Reference to type 'IListSource' claims it is defined in 'System', but it could not be found

I'm trying to add my package in which is the target framework is .Net Framework 4.5 Already add the Microsoft.NETCore.Portable.Compatibility": "1.0.1" to fix the mscorlib error

Below is the 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 is my package

Error enter image description here

enter image description here

Upvotes: 1

Views: 3737

Answers (1)

Tseng
Tseng

Reputation: 64259

First thing is, remove net45 from your import section, you are not supposed to abuse it this way. You are only allowed to use .NET Core compatible frameworks here, like portable-net45+win8, which are know to work with .NET Core because they share the same API surface.

NEVER use imports like that. It is only there to force nuget to restore certain nuget packagages, which are not yet targeting netstandard1.x, like certain Portable Class Libraries (PCL).

Abusing it for anything else, will just not work. You can't make .NET Framework 4.x libraries automagically work with .NET Core.

IListSource seems to be part of .NET Core but not of the "core" .NET Core packages. However packagesearch says it's in the SystemSystem.ComponentModel.TypeConverter package (see http://packagesearch.azurewebsites.net/?q=IListSource).

Upvotes: 1

Related Questions