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

送分小仙女□ 提交于 2019-11-28 07:16:34

问题


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(); 

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 ?


回答1:


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).

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.)



来源:https://stackoverflow.com/questions/30588478/console-does-not-contain-a-definition-for-readkey-in-asp-net-5-console-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!