.Net Core中的Console.Write [英] Console.Write in .Net Core
本文介绍了.Net Core中的Console.Write的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开始学习.Net Core。我想编写一个简单的 Hello World控制台应用程序。
I start to learn .Net Core. I want to write a simple 'Hello World' console application.
不幸的是, System.Console
最初不可用。这是我的代码:
Unfortunately the System.Console
is not available initially. This is my code:
using System;
class Program
{
public static void Main()
{
Console.WriteLine("Hello from Mac");
}
}
我应该安装什么软件包?
What package should I install?
仅供参考,我使用的Mac带有VSCode和.net core rc1更新2。
FYI, I'm using Mac with VSCode and .net core rc1 update 2.
推荐答案
确保在
frameworks:dnxcore50:dependencies
示例project.json:
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"
}
}
}
}
这篇关于.Net Core中的Console.Write的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文