DNX DNX VS核心 [英] DNX vs DNX Core

查看:140
本文介绍了DNX DNX VS核心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始一个非常简单的浅尝辄止,在VS2015 ASP.Net MVC(测试版)的项目和我有一个问题缠绕我的头周围的DNX DNX和核心引用。

I have started a very simple "kick the tires" ASP.Net MVC (beta) project in VS2015 and am having an issue wrapping my head around the DNX and DNX Core references.

在这个例子中,我试图用 DateTime.ToShortDateString(),并启用了DNX核心的智能感知。

In this example I am trying to use DateTime.ToShortDateString() and have the intellisense for DNX Core enabled.

据我了解,这是因为这不是在DNX核心实现,我可以环绕它的编译器指令。

I understand that this is because this isn't implemented in DNX Core and I can wrap compiler directives around it.

这是正确的做法?任何地方都记录在两个平台之间的差异?最后,如​​果我是一个所有的Windows,IIS都无时无刻店方的DNX核心提供任何东西,或应我的第一个任务是刚刚从project.json文件中删除?

Is this the correct approach? Are the differences between the two platforms documented anywhere? Finally, if I'm an all Windows, all IIS all the time shop does the DNX Core offer anything or should my first task to be to just remove it from the project.json file?

推荐答案

我想唯一的答案是它依赖。

I guess the only answer is it depends.

DNX运行在今天的.NET框架上(以及单声道),并已获得完整的.NET 4.5.2(现在的.NET 4.6)BCL。基本上,一切都已经从1.0添加到.NET。

Dnx runs on top of today's .NET framework (as well as mono), and has access to the full .NET 4.5.2 (now .NET 4.6) BCL. Basically everything has been added to .NET since 1.0.

DNX核心运行ontop的CoreClr基本上是.NET Framework的一个精简版的。有些东西丢失了,有些东西永远不会过来到CoreClr因各种原因。我不知道什么是未来/不来具体名单。您可以闲逛在 corefx coreclr GitHub的项目,看看有什么是存在的。

Dnx Core runs ontop of the CoreClr which is essentially a stripped down version of the .NET Framework. Some things are missing, some things will never be coming over to CoreClr for various reasons. I don't know of a specific list of what is coming / not coming. You can poke around on the corefx and coreclr github projects to see what is there.

现在的问题实际上是关于最好的办法。你有几个选择。

Now the question is really about the best approach. You have a few choices.

如果你没有上过上CoreCLR运行项目规划,那么你可以从你的project.json一起将其删除。

If you're not ever planning on running the project on the CoreCLR, then you can remove it from your project.json all together.

如果你打算在CoreCLR(不管是什么原因可能是)上运行,你可以做一些事情。

If you do plan on to run on CoreCLR (whatever the reason may be) you can do a few things.


  • 使用通用API方法对环境

  • Use the common API methods for the environment

在你的情况下,如果 theDate.ToString(D)等同于 theDate.ToShortDateString()然后为什么不直接使用前者?

In your case if theDate.ToString("d") is equivalent to theDate.ToShortDateString() then why not just use the former?

使用相应的编译器指令 DNX451

Use the appropriate compiler directive DNX451, etc.

对于那些不具备你要找你可以扔掉或实现自己的版本,如果是有意义的东西实施的环境。

For environments that don't have an implementation of what you're looking for you can throw or implement your own version if it makes sense.

这篇关于DNX DNX VS核心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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