从.NET 1.0的核心类库引用mscorlib程序4.0.0.0 [英] Referencing mscorlib 4.0.0.0 from .NET Core 1.0 class library

查看:1336
本文介绍了从.NET 1.0的核心类库引用mscorlib程序4.0.0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.NET 1.0的核心类库它面向.NET 4.6.1和引用的.NET标准库1.6.0和身份架构2.2.1

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...

在这里输入的形象描述

任何想法如何解决这个问题?

Any ideas how to resolve this?

推荐答案

有两个问题在这里您的项目文件,一个简单的修复,一是无法修复;)

There are two problems with your project file here, one simple to fix, one impossible to fix ;)


  • 您的项目的目标 net461 netstandard1.6 。你的project.json说的是:建立目标 netstandard1.6 和骗的NuGet,并声称你是 net461 (说谎是什么导入不......不相信我,看它;))。而且,由于你的project.json骗的NuGet,你在哪里能够添加 Microsoft.AspNet.Identity.EntityFramework 。添加 net461 netstandard1.6 并行不会帮助你,是因为你不能添加依赖即可。

  • 的依赖的NuGet Microsoft.AspNet.Identity.EntityFramework 被释放在2015年和基于.NET框架(基于mscorlib程序)并没有对.NET标准/ .NET核心(System.Runtime为主)。说谎的不利于有关事实的依赖是基于 mscorlib程序,而不是 System.Runtime

  • Your project does not target net461 and netstandard1.6. What your project.json says is: Build target for netstandard1.6 and lie to NuGet and claim you are net461 (that lying is what import does ... do not believe me, look it up ;)). And since your project.json lied to NuGet, you where able to add Microsoft.AspNet.Identity.EntityFramework. Adding net461 and netstandard1.6 in parallel will not help you either because you cannot add the dependency then.
  • The NuGet dependency Microsoft.AspNet.Identity.EntityFramework is released in 2015 and based on the .NET Framework (mscorlib based) and not on .NET Standard / .NET Core (System.Runtime based). The lying does not help about the fact that the dependency is based on mscorlib and not System.Runtime.

什么你可以尝试,是针对(正确地)并行 net461 netstandard1.6 ,并尝试做 Microsoft.AspNet.Identity.EntityFramework 和微软。 AspNetCore.Identity.EntityFrameworkCore 分别使用的#ifdefs。但是,结果会多么有用,我不知道什么产生的图书馆将被使用;)

What you could try, is targeting (correctly) in parallel net461 and netstandard1.6 and try to do a parallel implementation with Microsoft.AspNet.Identity.EntityFramework and Microsoft.AspNetCore.Identity.EntityFrameworkCore respectively using #ifdefs. However, how useful the result would be, I have no idea for what the resulting library would be used ;)

这篇关于从.NET 1.0的核心类库引用mscorlib程序4.0.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆