分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > IT知识

运行第一个.net core程序

发布时间:2023-09-06 01:14责任编辑:蔡小小关键词:暂无标签

前置条件 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#

运行效果

运行第一个.net core程序

原文地址:http://www.cnblogs.com/ProDoctor/p/7605823.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved