How to output to console in UWP on Windows 10?
Is there a way to write to console / command prompt / powershell (like Console.WriteLine()
) or anything similar in UWP apps?
If console is unavailable is there a proper alternative that I can use instead to write to the screen large amounts of text?
I, of course, can make a XAML control and output to it, but it doesn't seem to be convenient in comparison to simple Console.WriteLine()
.
There is also very old discussion on WPF console, but nothing seems to work from there (at least, I couldn't find Project-Properties-Application tab-Output Type-Console Application
and Trace.WriteLine("text")
is unavailable).
Solution 1:
You can use Debug.WriteLine method from System.Diagnostics namespace
MSDN Link
When you start debugging your application those messages will be displayed in the Output Window (Standard VS shortcut is Ctrl+Alt+O, ReSharper shortcut is Ctrl+W, O)
Solution 2:
Starting with RS4 (the release coming out mid-2018) you can build command - line apps with UWP or output info to the command line. The pre-release SDK is already available and you can watch a Channel 9 video.