.NET跨平台:再见dnx,你好dotnet cli

昨天在github上dnx的一个issue中看到这样一段话:

we're retiring dnx/dnu/dnvm toolchain and will move to dotnet CLI in RC2.

才知道dnx即将退役,取而代之的是donet cli,难怪最近github上dnx没有git commits呢。

立马直奔donet cli的github主页,在readme中看到了 http://dotnet.github.io/getting-started/ ,于是根据getting started在linux ubuntu上安装dotnet cli快速体验了一下。

安装命令如下:

sudo sh -c 'echo "deb [arch=amd64] http://apt-mo.trafficmanager.net/repos/dotnet/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
sudo apt-get update
sudo apt-get install dotnet

没有了dnvm的身影,直接用apt-get安装,与linux有了更好的融合。

创建并运行一个hello world程序试试:

mkdir hello-world && cd $_
dotnet new
dotnet restore
dotnet run

运行结果:

Hello World!

之前运行程序用dnx,安装包包用dnu,现在统一用dotnet命令,这样的节奏更对头了。

接着在网上找了找资料,更多了解dotnet cli。

首先找到了 What is the difference between DNX and CLI?

To a large degree, we're just re-factoring DNX as opposed to 'replacing it' outright.

接着发现了 Intro to .NET Core CLI

.NET Core includes three new components: a set of standalone command-line (CLI) tools, a shared framework and a set of runtime services. These components will replace DNX and are essentially DNX split in three parts.
...
ASP.NET 5 will transition to the new tools for RC2. This is already in progress. There will be a smooth transition from DNX to these new .NET Core components.

再接着寻到了 Exploring the new .NET "dotnet" Command Line Interface (CLI)

My thinking has always been that when a new person sits down to learn node, python, ruby, golang, whatever, for the most part their experience is something like this. It should be just as easy - or easier - to use .NET.

感言

在RC阶段(目前.NET Core RC2)竟然发生如此大的变化,出乎人的意料,让人有种恨铁不成钢的感觉,也让人体会到了.NET在跨平台过程中的折腾、矛盾、徘徊。但是从结果来看,dotnet cli的确比dnx更对路,从中也可以看出.NET不仅仅是在为了跨平台而”跨“平台,而是在跨平台的过程中不断完善自己。

posted @ 2015-12-31 11:03 dudu 阅读(...) 评论(...) 编辑 收藏