Birdman
Birdman

Reputation: 1524

Can't access System.Console in Monogame app C#

I cloned a Monogame app which I am testing out. I have included using System; at the top of my file. Visual Studio shows that it's not being used. When I try to type Console.WriteLine(""); in my code, or even System.Console.WriteLine(""); (which shouldn't even require a using directive) it's simply not recognized.

enter image description here

Error CS0234: The type or namespace name 'Console' does not exist in the namespace 'System' (are you missing an assembly reference?)

I'm aware that currently my app is not a Console app since it's a game. I'm not sure if this has anything to do with it, although I would think I would still be able to using System.Console, even if there wasn't a console to print it to...

(This brings up a side note, which is that I can't seem to add a console window to my program, as described in this answer: https://stackoverflow.com/a/39011035/8887398. The option just simply isn't there. See picture below.)

enter image description here

Upvotes: 0

Views: 959

Answers (1)

Victor Chelaru
Victor Chelaru

Reputation: 4817

The fact that your app is a MonoGame app has nothing to do with the problem you're encountering. It's because your app is a UWP app (this wasn't mentioned in your post, but I guessed so based on the screenshot). There is no System.Console in UWP apps.

For more info see:

How to use System.Console in UWP

Upvotes: 1

Related Questions