5

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!

4

4 回答 4

5

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

于 2013-04-03T20:23:08.777 回答
2

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.

于 2013-03-31T00:26:41.393 回答
0

Close the project and edit it as text. Change:

<OutputType>WinExe</OutputType>

To:

<OutputType>Exe</OutputType>

Then reload the project.

于 2013-03-31T00:40:07.537 回答
0

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.

于 2013-03-31T02:26:47.487 回答