.NetCoreApp和.NetStandard.Library有什么区别?

编程入门 行业动态 更新时间:2024-10-27 04:28:32
本文介绍了.NetCoreApp和.NetStandard.Library有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

.Net Core 1.0已于几天前发布,我已经开始使用它.我创建了一个简单的解决方案,其中有一个项目(类库=> .NetStandard.Library),其次是控制台应用程序(.NetCoreApp).关键是,控制台应用程序已引用库,但是我不能使用该库的类型.这两个框架不兼容吗?我想念什么吗?

.Net Core 1.0 has been released couple days ago, and i've started playing with it. I've created simple solution, with one project (class library => .NetStandard.Library) and second, console application (.NetCoreApp). The point is, console application has reference to library, but i cant use types form that library. Are those two frameworks incompatible? Am i missing something?

用于控制台应用程序的project.json:

project.json for console application:

{ "version": "1.0.0-*", "buildOptions": { "emitEntryPoint": true }, "dependencies": { "ConsoleApplicationLibrary": "1.0.0-*", "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0" } }, "frameworks": { "netcoreapp1.0": { "imports": "dnxcore50" } } }

针对库的project.json:

project.json for library:

{ "version": "1.0.0-*", "dependencies": { "NETStandard.Library": "1.6.0" }, "frameworks": { "netstandard1.6": { "imports": "dnxcore50" } } }

我已经弄清楚了,它可以工作,并且可以编译代码,但是Visual Studio仍然将库中的类型突出显示为未知.

I've figured it out, that it works, and code compiles, but visual studio still highlights types from library as unknown.

推荐答案

.NetCoreApp 是平台,而 .NetStandard.Library 是应该跨平台的库(可移植类库),用于各种.NET平台运行时.

.NetCoreApp is a platform and .NetStandard.Library is a library supposed to be cross platform (portable class library) for various .NET platforms runtimes.

您可以在所支持的任何.NET平台项目中(例如,.NETCoreApp(点Net Core 1.X))包含NetStandard.Library的直接引用(程序包)

You can include a direct reference (package) of NetStandard.Library in any of your .NET platform project that is supported, for ex .NETCoreApp (Dot Net Core 1.X)

参考: docs.microsoft/zh-我们/dotnet/articles/standard/library

更多推荐

.NetCoreApp和.NetStandard.Library有什么区别?

本文发布于:2023-11-14 08:58:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586780.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有什么区别   NetCoreApp   NetStandard   Library

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!