Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

c# - Referencing mscorlib 4.0.0.0 from .NET Core 1.0 class library

I have a .NET Core 1.0 class library which targets .NET 4.6.1 and references the .NET Standard Library 1.6.0 and Identity Framework 2.2.1

project.json

{
    "version": "1.0.0-*",

    "dependencies": {
        "Microsoft.AspNet.Identity.EntityFramework": "2.2.1",
        "System.Runtime": "4.1.0",
        "NETStandard.Library": "1.6.0"
    },

    "frameworks": {
        "netstandard1.6": {
            "imports": [
                "net461"
            ]
        }
    }
}

In my project I'm just creating the identity models, which extend the base Identity Framework models (User, Role etc). When I try to compile, this happens...

enter image description here

enter image description here

Any ideas how to resolve this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Microsoft has a nuget package that can help. I don't know the specifics of how it works but it resolved my dependency issues:

https://www.nuget.org/packages/Microsoft.NETCore.Portable.Compatibility/

Or simply run this in the package manager console:

Install-Package Microsoft.NETCore.Portable.Compatibility -Version 1.0.1

edit: This was added to a .net core 1.1 project.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...