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

查看:108
本文介绍了在"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核心.这就是为什么它说它对于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天全站免登陆