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 ?
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.)
See more on this question at Stackoverflow