是什么在project.json'依赖'和'frameworkAssemblies'之间的区别? [英] What is the difference between 'dependencies' and 'frameworkAssemblies' in project.json?

查看:225
本文介绍了是什么在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'之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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