Console.Write in .Net Core

后端 未结 3 468
挽巷
挽巷 2021-01-08 01:22

I start to learn .Net Core. I want to write a simple \'Hello World\' console application.

Unfortunately the System.Console is not available initially. T

3条回答
  •  独厮守ぢ
    2021-01-08 01:40

    Make sure in your project.json system.console is referenced under frameworks:dnxcore50:dependencies

    Example project.json:

    {
      "version": "1.0.0-*",
      "description": "ConsoleApp1 Console Application",
      "authors": [ "danny" ],
      "tags": [ "" ],
      "projectUrl": "",
      "licenseUrl": "",
    
      "compilationOptions": {
           "emitEntryPoint": true
      },
    
      "dependencies": {
      },
    
      "commands": {
        "ConsoleApp1": "ConsoleApp1"
      },
    
      "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"
          }
        }
      }
    }
    

提交回复
热议问题