那么, 今天的任务呢是在linux上安装 .net 5 运行时
ok, 先决条件:
Ubuntu 14 (openSuse 42和Ubuntu 15都失败了... 别问我为什么)
开始安装:
- 安装 .NET Version Manager (DNVM)
sudo apt-get install unzip curlcurl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
- 安装 .NET Execution Environment (DNX)
sudo apt-get install libunwind8 gettext libssl-dev libcurl4-openssl-dev zlib1g libicu-dev uuid-devdnvm upgrade -r coreclr
- libuv
sudo apt-get install make automake libtool curlcurl -sSL https://github.com/libuv/libuv/archive/v1.8.0.tar.gz | sudo tar zxfv - -C /usr/local/srccd /usr/local/src/libuv-1.8.0sudo sh autogen.shsudo ./configuresudo makesudo make installsudo rm -rf /usr/local/src/libuv-1.8.0 && cd ~/sudo ldconfig
测试: dnvm / dnx / dnu
这里呢只是安装了 .NET Core , 并没有安装其它的东西现在是不是迫不急待的想试试呢?
先来个最简单哒.llh@llh-PC:~/workspaces/test1$ vim Program.cs using System;namespace test1{ public class Program { public static void Main(string[] args) { Console.WriteLine("Hello World"); Console.Read(); } }}llh@llh-PC:~/workspaces/test1$ vim project.json{ "version": "1.0.0-*", "description": "test1 Console Application", "authors": [ "" ], "tags": [ "" ], "projectUrl": "", "licenseUrl": "", "tooling": { "defaultNamespace": "test1" }, "dependencies": { }, "commands": { "test1": "test1" }, "frameworks": { "dnx451": { }, "dnxcore50": { "dependencies": { "System.Console": "4.0.0-beta-23516" } } }}
好嘞~~~~
llh@llh-PC:~/workspaces/test1$ dnu restorellh@llh-PC:~/workspaces/test1$ dnx run
哟哟哟, 是不是输出啦?
------------当当当~~,再来一款工具---------------------------------------------
这个就需要node配合啦npm install -g yo generator-aspnet gulp bower
然后执行yo aspnet
,然后就可以选择生成的项目呐 ps: 生成web项目的时候,用到了sqlite3作为数据库,所以你可能需要安装sqlite3的库呐, sudo apt-get install sqlite3 libsqlite3-dev
控制台前面已经说过了,这里就生成web喽 dnu restorednx web