zoukankan      html  css  js  c++  java
  • .NET Core 1.0最简单的Hello world控制台程序

    使用任意的文本编辑软件,新建两个文件

    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

    image

    等待下载包,执行成功的提示

    image

    执行命令:dnx run

    image

    成功完成!

    CentOS环境下

    基本与WIndows下一样

    执行命令:dnu resotre

    image

    执行命令:dnx run

    image

  • 相关阅读:
    12
    11
    10
    9
    8
    7
    6
    5
    4
    3
  • 原文地址:https://www.cnblogs.com/draweye/p/5239137.html
Copyright © 2011-2022 走看看