准备工作

  • 使用Hyper-V安装Ubuntu16.04桌面版
    因为是作为类似日记的记录,所以写的时候事无巨细,稍显啰嗦。
    打开微软.NET官网


apt-get install

打开dotnetcore ubuntu


按照官网步骤

1、Add the dotnet apt-get feed

In order to install .NET Core on Ubuntu or Linux Mint, we need to first set up the apt-get feed that hosts the package we need.

For Ubuntu 14.04 or Linux Mint 17, run the following commands

 a@a-Virtual-Machine:~$ sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'

 a@a-Virtual-Machine:~$ sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893

 a@a-Virtual-Machine:~$ sudo apt-get update

For Ubuntu 16.04, run the following commands

 a@a-Virtual-Machine:~$ sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list'

 a@a-Virtual-Machine:~$ sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893

 a@a-Virtual-Machine:~$ sudo apt-get update

2、 Install .NET Core SDK

Before you start, please remove any previous versions of .NET Core from your system by using this script.

To .NET Core on Ubuntu or Linux Mint, simply use apt-get.

  a@a-Virtual-Machine:~$ sudo apt-get install dotnet-dev-1.0.-preview2- 

3、Initialize some code

Let’s initialize a sample Hello World application!

 a@a-Virtual-Machine:~$ mkdir hwapp 
a@a-Virtual-Machine:~$ cd hwapp
a@a-Virtual-Machine:~$ dotnet new 

执行dotnet new之后,查看文件目录

a@a-Virtual-Machine:~/hwapp$ dotnet new
Created new C# project in /home/a/hwapp.
a@a-Virtual-Machine:~/hwapp$ ls
Program.cs project.json
a@a-Virtual-Machine:~/hwapp$

4、Run the app

The first command will restore the packages specified in the project.json file, and the second command will run the actual sample:

a@a-Virtual-Machine:~/hwapp$ dotnet restore
a@a-Virtual-Machine:~/hwapp$ dotnet run

执行dotnet restore

a@a-Virtual-Machine:~/hwapp$ dotnet restore
log : Restoring packages for /home/a/hwapp/project.json...
log : Writing lock file to disk. Path: /home/a/hwapp/project.lock.json
log : /home/a/hwapp/project.json
log : Restore completed in 1759ms.
a@a-Virtual-Machine:~/hwapp$ ls -o
总用量
-rwxrw-r-- a 6月 : Program.cs
-rwxrw-r-- a 6月 : project.json
-rwxrw-r-- a 7月 : project.lock.json

执行dotnet run

a@a-Virtual-Machine:~/hwapp$ dotnet run
Project hwapp (.NETCoreApp,Version=v1.) will be compiled because expected outputs are missing
Compiling hwapp for .NETCoreApp,Version=v1. Compilation succeeded.
Warning(s)
Error(s) Time elapsed ::02.4613028 Hello World!
a@a-Virtual-Machine:~/hwapp$ ls -o
总用量
drwxrwxr-x a 7月 : bin
drwxrwxr-x a 7月 : obj
-rwxrw-r-- a 6月 : Program.cs
-rwxrw-r-- a 6月 : project.json
-rwxrw-r-- a 7月 : project.lock.json

.NET CORE实践(1)--Ubuntu下的Hello World的更多相关文章

  1. Ubuntu下搭建.Net Core环境并发布MVC项目

    支撑环境 1. Windows 10 1809 12月更新版本(其他版本应该也行,但建议不低于1809,过低的版本可能无法安装子系统ubuntu18.04 LTS) 2. ubuntu 18.04 L ...

  2. win10与ubuntu下演示运行.net core rc2 1.0.0.3002702程序

    随着.net core rc2(1.0.0.002702)发布的同时,我们也来在本地 win10与ubuntu玩一下吧. 先简单说下.net core ,在.net core rc1中用的是dnx 工 ...

  3. 在Linux(Ubuntu)下搭建ASP.NET Core环境并运行 继续跨平台

    最新教程:http://www.cnblogs.com/linezero/p/aspnetcoreubuntu.html 无需安装mono,在Linux(Ubuntu)下搭建ASP.NET Core环 ...

  4. ubuntu下发布asp.net core并用nginx代理之旅

    asp.net core 1.0.1发布已有些日子了,怀着好奇的心情体验了把ubuntu下的asp.net core 系统运行环境:ubuntu 16.0.4 for developer 首先搭建.n ...

  5. dotnet core 2.0在ubuntu下安装失败

    在ubuntu下安装.net core2.0失败了,不知道是什么原因.按照微软官方的步骤.似乎走不通.偶然翻到debian的安装方法,发现debian系统居然是直接下载包安装的.没经过apt.尝试一把 ...

  6. .net core跨平台应用研究-ubuntu core下配置.net core运行时

    引言 年初研究了一阵子.net core跨平台应用,先后发表了几篇应用研究的文章.因工作原因,忙于项目上线,有一阵子没来博客园写文章了.最近项目基本收尾,抽空翻了下自己的博客,廖廖几篇文章,真让人汗颜 ...

  7. ubuntu下发布asp.net core并用nginx代理之旅(续)

    前面实现了ubuntu下的发布,然而实际项目一般为visual studio中发布文件系统,然后上传至生产环境中,(部分参考:上传文件到linux - ubuntu) 这节就发布到生产环境中的: 1. ...

  8. ubuntu下pycharm调用Hanlp实践分享

    前几天看了大快的举办的大数据论坛峰会的现场直播,惊喜的是hanlp2.0版本发布.Hanlp2.0版本将会支持任意多的语种,感觉还是挺好的!不过更多关于hanlp2.0的信息,可能还需要过一段时间才能 ...

  9. Linux(Ubuntu)下搭建ASP.NET Core环境

    今天来学习一下ASP.NET Core 运行在Ubuntu中.无需安装mono . 环境 Ubuntu 14.04.4 LTS 服务器版 全新安装系统. 下载地址:http://mirrors.neu ...

  10. imagemagick 之 Fred's ImageMagick Scripts 在Ubuntu 下的实践

    Fred's ImageMagick Scripts 官网:http://www.fmwconcepts.com/imagemagick/index.php Windows 10 (64-bit) u ...

随机推荐

  1. Object constraint language for code generation from activity models

    一.基本信息 标题:Object Constraint Language for Code Generation from Activity Models 时间:2018 出版源:Informatio ...

  2. Servlet中的jsp内置对象

    Servlet和jsp本质相同,那么为什么还要使用jsp呢,原来的servlet又有什么不好的呢. Servlet和jsp可以做完全相同的事情,就要借助jsp的内置对象们,比如request,resp ...

  3. springcloud config 提取公共参数

    每个微服务都有自己的配置文件application-local.yml和bootstrap.yml, 这个两个配置文件的读取顺序是先读取bootstrap.yml文件,在读取application-l ...

  4. 架构(一)JDK安装

    一 遇到的问题 问题1:安装jdk的时候,jdk解压失败? 我是通过wget http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b84 ...

  5. httpclient的调用 发送json字符串

    public static String postHttp(JSONObject jsonObject, String jsonUrl){ String responseMsg="" ...

  6. text-decoration:[ text-decoration-line ] || [ text-decoration-style ] || [ text-decoration-color ] 默认值:

    css3中字体装饰,多样化的界面效果,: [ text-decoration-line ]:指定文本装饰的种类.相当于CSS2.1的 text-decoration 属性, 可取值:none | un ...

  7. Nuget4.0 bug一粒

    这个锅到底是nuget的还是msbuild的我也不是很确定 在使用Nuget4.0打包编译项目时 当执行到nuget pack %%~dpna.csproj -build -Prop Configur ...

  8. 使用 VSTS 进行 CI 的过程中,无法识别 .NET Core 2.x 的情况处理

    大概是由于 .NET Core 2.1 还没有正式发布,使用 VSTS 进行持续集成(CI)的过程中,自动 Build 的环节无法识别 .NET Core 2.1 的框架,查看日志会提示如下错误: V ...

  9. Android JNI 学习(十一):Invocation Api

    1. 简介 Invocation API允许软件提供商在原生程序中内嵌Java虚拟机.因此可以不需要链接任何Java虚拟机代码来提供Java-enabled的应用程序. 以下代码演示如何使用: #in ...

  10. LabVIEW(一):知识入门

    一.DAQ基础知识简介 1.DAQ是英文Data Acquisition (数据采集)的缩写. 数据采集(DAQ)是指测量:电压.电流.温度.压力.声音.编码数据等电气或物理现象的过程. 2.数据采集 ...