运行第一个.net core程序

前置条件 ubuntu已安装.net core运行环境

 

分6步

mkdir netcore 创建一个项目文件夹

cd netcore   进入该文件夹

dotnet new  new命令 用于创建一个新的控制台应用程序

 dotnet restore  分析 project.json 文件, 下载依赖并返回结果

dotnet build  编译项目

dotnet run  运行项目

 

 

root@ubuntu:~/firstnetcore# mkdir netcore
root@ubuntu:~/firstnetcore# cd netcore
root@ubuntu:~/firstnetcore/netcore# dotnet new
Created new C# project in /root/firstnetcore/netcore.
root@ubuntu:~/firstnetcore/netcore# ls
Program.cs project.json
root@ubuntu:~/firstnetcore/netcore# dotnet restore
log : Restoring packages for /root/firstnetcore/netcore/project.json...
log : Writing lock file to disk. Path: /root/firstnetcore/netcore/project.lock.json
log : /root/firstnetcore/netcore/project.json
log : Restore completed in 2336ms.
root@ubuntu:~/firstnetcore/netcore# dotnet build
Project netcore (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
Compiling netcore for .NETCoreApp,Version=v1.0

Compilation succeeded.
0 Warning(s)
0 Error(s)

Time elapsed 00:00:00.8093903

root@ubuntu:~/firstnetcore/netcore# dotnet run
Project netcore (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
Hello World!
root@ubuntu:~/firstnetcore/netcore#

运行效果

 

转载于:https://www.cnblogs.com/ProDoctor/p/7605823.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值