使用任意的文本编辑软件,新建两个文件
1.Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace TestNuGetConsole { public class Program { public static void Main(string[] args) { Console.WriteLine("Hello from DNX!"); } } }
2.project.json
{ "version": "1.0.0-*", "description": "TestNuGetConsole Console Application", "authors": [ "eric" ], "tags": [ "" ], "projectUrl": "", "licenseUrl": "", "compilationOptions": { "emitEntryPoint": true }, "dependencies": { }, "commands": { "TestNuGetConsole": "TestNuGetConsole" }, "frameworks": { "dnx451": { }, "dnxcore50": { "dependencies": { "Microsoft.CSharp": "4.0.1-beta-23516", "System.Collections": "4.0.11-beta-23516", "System.Console": "4.0.0-beta-23516", "System.Linq": "4.0.1-beta-23516", "System.Threading": "4.0.11-beta-23516" } } } }
Windows环境下
窗口+R,输入cmd,然后使用cd命令进入文件所在目录。
执行命令:dnu restore
等待下载包,执行成功的提示
执行命令:dnx run
成功完成!
CentOS环境下
基本与WIndows下一样
执行命令:dnu resotre
执行命令:dnx run