除了dnx451之外,创建dnx50构建目标是否有其他差异/原因? [英] Is there any difference/reason to create dnx50 build target in addition to dnx451?

查看:89
本文介绍了除了dnx451之外,创建dnx50构建目标是否有其他差异/原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,我们在project.json中看到以下目标:

Usually we see the following targets in project.json:

"frameworks": {
    "net45": {},
    "dnx451": {},
    "dnxcore50": { }
}

dnxcore50将是项目代码的唯一可移植版本,而dnx451实际上是针对.Net 4.5.1 mscorlib等的.

dnxcore50 will be the only portable version of the project code and dnx451 actually targets .Net 4.5.1 mscorlib etc...

现在,如果我添加另一个名为dnx50的目标,这将创建有效的输出并正常运行.

Now, if I add another target called dnx50, this will create a valid output and works just fine.

dnx451和dnx50之间的区别是,它引用了不同的.Net程序集dll

The difference between dnx451 and dnx50 is, that it references different .Net assembly dlls

例如mscorlib.dll:

  • dnx451 参考C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\mscorlib.dll
  • dnx50 引用了C:\Windows\Microsoft.NET\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll,它实质上是.net 4.6版本.
  • dnx451 references C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\mscorlib.dll
  • dnx50 references C:\Windows\Microsoft.NET\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll which essentially is the .net 4.6 version.

现在的问题是:

例如为您的自定义库创建该dnx50目标是否有意义?基本上以.net 4.6为目标,并且您需要dnxcore50可移植程序没有的某些功能吗?

Does it make sense to create that dnx50 target for your custom library for example? Basically to target .net 4.6 and you need certain functionality the dnxcore50 portable doesn't have?

或者dnx451目标实际上就足够了,如果我不需要最新的.net版本(4.5.2、4.6)中的特定功能,则如果已安装此目标,则无论如何都将使用.net 4.6.在系统上,而我只是针对我的项目所需的最低版本?

Or is the dnx451 target actually enough, and if I don't need a specific feature from the more recent .net versions (4.5.2, 4.6), this target would use .net 4.6 anyways if it is installed on the system and I'm just targeting the lowest version necessary for my project?

这是否意味着同时拥有dnx451和dnx50目标,会创建相同的输出,对吗?

Does that mean that having both, a dnx451 and dnx50 target, would actually create the same output, right?

推荐答案

请参见

See this question for full details. Here is a list of all the different types you can use:

  • dnxcore50-在CoreCLR/CoreFx上运行的DNX SDK
  • dnx451-在.Net 4.5.1(桌面CLR/完整BCL和FCL)上运行的DNX SDK
  • net46-在.Net 4.6(桌面CLR/完整BCL和FCL)上运行的.Net Framework SDK.
  • uap10.0-在.Net Native/CoreFx上运行的UWP SDK
  • dotnet-声明其依赖项(而不是PCL合同)的任何纯IL代码.框架依赖项可用于.Net 4.6,DNX或UWP.
  • dnxcore50 - DNX SDK running on CoreCLR/CoreFx
  • dnx451 - DNX SDK running on .Net 4.5.1 (Desktop CLR / Full BCL and FCL)
  • net46 - .Net Framework SDK running on .Net 4.6 (Desktop CLR / Full BCL and FCL).
  • uap10.0 - UWP SDK running on .Net Native/CoreFx
  • dotnet - any pure IL code which declares its dependencies (instead of a PCL contract). Framework dependencies are available for .Net 4.6, DNX or UWP.

对于.NET 4.5,您需要将dnx45用于ASP.NET项目,将net45用于其他项目,以将.NET 4.5作为目标.定位哪个目标取决于您要执行的操作,甚至一次可以定位多个目标.

For .NET 4.5 you need to use dnx45 for ASP.NET projects and net45 for other projects to target .NET 4.5. Which one you target depends on what you want to do, you can even target more than one at a time.

当前.NET Core(DNX)具有非常有限的功能.如果这样做还不够,请针对使用.NET 4.6的ASP.NET 5设置完整的.NET运行时dnx46,并针对使用.NET 4.6的其他项目设置net46.

Currently the .NET Core (DNX) has very limited functionality. If this does not give you enough, then target the full .NET runtime dnx46 for ASP.NET 5 using .NET 4.6 and net46 for other projects using .NET 4.6.

这篇关于除了dnx451之外,创建dnx50构建目标是否有其他差异/原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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