“控制台"在 asp.net 5 控制台应用程序中不包含“ReadKey"的定义 [英] 'Console' does not contain a definition for 'ReadKey' in asp.net 5 console App

查看:27
本文介绍了“控制台"在 asp.net 5 控制台应用程序中不包含“ReadKey"的定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 VS2015 CTP 中的 ASP.NET 5 控制台中创建一个简单的应用程序.对于下面的代码行

I am creating a Simple application in ASP.NET 5 Console in VS2015 CTP. For the below line of code

// Wait for user input
            Console.ReadKey(); 

我收到错误控制台"不包含ReadKey"的定义.另外,我收到了一个建议为 ASP.Net 5.0-Available ASP.NET Core 5.0- Not available.ReadKey 关键字不再使用?这个建议意味着我需要添加一些参考?

I am getting error 'Console' does not contain a definition for 'ReadKey'. Also i am getting a Suggestion as ASP.Net 5.0-Available ASP.NET Core 5.0- Not available. ReadKey keyword is no more used ? what does that suggestion means i need to add some reference ?

推荐答案

基本上,Console.ReadKey 在完整框架中是可用的,但不是 在 .NET Core 中可用.这就是为什么它说它对 ASP.NET 5.0可用"(针对完整框架构建)但对 ASP.NET Core 5.0不可用"(针对 CoreCLR 构建).

Basically, Console.ReadKey is available in the full framework, but isn't available in .NET Core. That's why it's saying it's "Available" for ASP.NET 5.0 (building against the full framework) but "Not available" for ASP.NET Core 5.0 (building against CoreCLR).

要么停止使用它,要么仅针对完整框架进行构建 - 编辑您的 project.json 文件以从您的 frameworks 属性中删除核心"选项.(确切的名称将取决于您使用的 ASP.NET 5 版本.例如,它可能是 dnxcore50.)

Either stop using it, or only build against the full framework - edit your project.json file to remove the "core" option from your frameworks property. (Exactly what it will be called will depend on which version of ASP.NET 5 you're using. It may be dnxcore50 for example.)

这篇关于“控制台"在 asp.net 5 控制台应用程序中不包含“ReadKey"的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆