Reputation: 125
I wrote a code, and the line
string thing = Console.ReadLine();
causes a problem. Xamarin shows me that it did not read in the input this command, so the variable thing becomes null.
I found from other questions and answers here that there are two output types of an application, Window and Console. So, mine probably is not the second one.
But I can't find how to switch to console. I have the latest MonoDevelop and Xamarin, and yet this problem remains. Does anyone know what could help?
Any advice will be highly appreciated!
Upvotes: 5
Views: 6426
Reputation: 1273
Rob G Pretty much has it so I'm not sure why you can't see it. Here's the click-by-click for completeness.
For console output from Xamarin:
Right click the project you have set as startup project, then do:
Options >> Expand 'Run' >> General >> Check 'Run on external console'
Once this is set, execution will halt on Console.ReadLine();
There is no need to check the 'Pause console output' checkbox. This simply holds the console open at the end of execution with a 'Press any key to continue...'.
Upvotes: 5
Reputation: 125
What turned out to help was to start a new project, and when Xamarin asks what type, choose C# Console Project. Which seems pretty reasonable.
Upvotes: 0
Reputation: 20802
Close the project and edit it as text. Change:
<OutputType>WinExe</OutputType>
To:
<OutputType>Exe</OutputType>
Then reload the project.
Upvotes: 0
Reputation: 3526
Try right clicking on the "options" list item on the menu for your project and making sure Run on external console is marked. It's in the Run -> General tab, I think.
Upvotes: 2