是什么在project.json'依赖'和'frameworkAssemblies'之间的区别?

编程入门 行业动态 更新时间:2024-10-24 12:29:00
本文介绍了是什么在project.json'依赖'和'frameworkAssemblies'之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使用project.json 了解ASP.NET 5应用文档包括一个示例项目以.json文件(以下简称版)。

The documentation for using project.json for ASP.NET 5 applications includes a sample project.json file (abbreviated version below).

什么是 frameworkAssemblies 和相关性的差别?

和为什么 dnx451 使用一个和 dnxcore50 用其他的?

And why does dnx451 use one and dnxcore50 use the other?

{ "version": "0.1-alpha-*", ... "frameworks": { "dnx451": { "frameworkAssemblies": { ... } }, "dnxcore50": { "dependencies": { ... } } }

推荐答案

frameworkAssemblies 指的是在GAC集会present(全局程序集缓存)。

frameworkAssemblies refers to assemblies present in GAC (global assembly cache).

请看下面的例子:结果我想用ADO.NET的API(的SqlConnection ,的SqlCommand )与SQL Server数据库的工作。我知道,这些API System.Data.dll中的一部分,因此要引用它。现在安装.NET Framework的完整版时,安装在GAC某些组件(其中有本 System.Data.dll中太),因此你看到一个参考 frameworkassemblies 在下面的例子。来到CoreClr,我需要找出其中封装这些类型的存在。为此,你可以使用名为 PackageSearch 的网站(由ASP.NET构建团队成员),您可以搜索类型,找到包的名称。在此基础上,你会发现 System.Data.SqlClient的是包。由于这个包是专为CoreClr,它是部分依赖的 dnxcore50 部分部分。

Consider the following example: I want to use ADO.NET apis(SqlConnection, SqlCommand) to work with a SQL Server database. I know that these apis are part of System.Data.dll and so want to reference it. Now when the full version of .NET Framework is installed, it installs some assemblies in the GAC (which has this System.Data.dll too) and hence you see a reference to frameworkassemblies in the below example. Coming to CoreClr, I need to find out in which package these types exist. For this you could use the website called PackageSearch(built by an ASP.NET team member) where you can search for a type and find the package name. Based on this you will find System.Data.SqlClient to be the package. Since this package is built for CoreClr, it is part of dependencies section within the dnxcore50 section.

{ "version": "1.0.0-*", "description": "Test App", "dependencies": { }, "frameworks": { "dnx451": { "frameworkAssemblies": { "System.Data": "4.0.0.0" } }, "dnxcore50": { "dependencies": { "System.Data.SqlClient": "4.0.0-beta-*" } } } }

现在让我们假设你想,即使在您的应用程序添加了JSON序列化和反序列化支持,并希望引用Json.Net的NuGet包。 Json.Net的NuGet包同时支持桌面和核心CLR,因此你将其放在依赖双方共同框架部分。

Now let's say you want to even add support for json serialization and deserialization in your app and want to reference Json.Net nuget package. Json.Net nuget package supports both the desktop and core clr and hence you would put it in the dependencies section common to both frameworks.

{ "version": "1.0.0-*", "description": "Test App", "dependencies": { "Newtonsoft.Json": "6.0.6" }, "frameworks": { "dnx451": { "frameworkAssemblies": { "System.Data": "4.0.0.0" } }, "dnxcore50": { "dependencies": { "System.Data.SqlClient": "4.0.0-beta-*" } } } }

更多推荐

是什么在project.json'依赖'和'frameworkAssemblies'之间的区别?

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

发布评论

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

>www.elefans.com

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