简体   繁体   English

'console'在asp.net 5控制台应用程序中不包含'ReadKey'的定义

[英]'Console' does not contain a definition for 'ReadKey' in asp.net 5 console App

I am creating a Simple application in ASP.NET 5 Console in VS2015 CTP . 在VS2015 CTP的ASP.NET 5控制台中创建一个简单的应用程序。 For the below line of code 对于以下代码行

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

I am getting error 'Console' does not contain a definition for 'ReadKey' . 我收到错误'Console'不包含'ReadKey'的定义 Also i am getting a Suggestion as ASP.Net 5.0-Available ASP.NET Core 5.0- Not available . 此外,我得到一个建议作为ASP.Net 5.0-Available ASP.NET Core 5.0- Not available ReadKey keyword is no more used ? 不再使用ReadKey关键字? what does that suggestion means i need to add some reference ? 这个建议意味着我需要添加一些参考?

Basically, Console.ReadKey is available in the full framework, but isn't available in .NET Core. 基本上, Console.ReadKey 全框架可用,但不可用于.NET的核心。 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). 这就是为什么它说ASP.NET 5.0的“可用”(针对完整框架构建)但ASP.NET Core 5.0的“不可用”(针对CoreCLR构建)。

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. 要么停止使用它,要么只针对完整框架构建 - 编辑project.json文件以从frameworks属性中删除“core”选项。 (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.例如,它可能是dnxcore50 。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM