Visual Studio 2013 - 如何在控制台中查看输出? [英] Visual Studio 2013 - How do I view output in the console?

查看:5188
本文介绍了Visual Studio 2013 - 如何在控制台中查看输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的C#和VS,我只是试图打印一行使用Console.WriteLine(...),但它只显示在命令提示符。有没有办法使输出在输出窗口中显示?

I'm new to C# and VS and I'm just trying to print a line using Console.WriteLine(...) but it only shows up in the command prompt. Is there a way to make output show in the output window instead?

编辑:这是一个控制台应用程序。

It's a console application.

另外,如何访问命令行以运行程序?我只能找出如何使用F5运行,但是如果我需要输入参数,这将无法工作。

Also, how do I access the command line in order to run programs? I've only been able to figure out how to run with F5, but this won't work if I need to type in arguments.

推荐答案

如果是ConsoleApplication,则 Console.WriteLine 将写入控制台。如果使用 Debug.Print ,它将打印到底部的输出选项卡。

If it's a ConsoleApplication then Console.WriteLine will write the console. If you use Debug.Print, it will print to the Output tab at the bottom.

添加命令行参数,这可以在项目属性中找到。单击项目 - > [YourProjectName]属性... - >调试 - >开始选项 - >命令行参数。此处的文本将在运行时传递给您的应用程序。您还可以通过运行它从 bin \Release bin \Debug 文件夹在你构建之后,通过 cmd 或者你喜欢。我发现更容易测试各种参数这种方式,而不是每次设置命令行参数。

If you want to add command line arguments, this can be found in the project properties. Click Project -> [YourProjectName] Properties... -> Debug -> Start Options -> Command line arguments. The text here will be passed to your application when it's run. You can also run it after it's built by running it out of the bin\Release or bin\Debug folder after you build it, through cmd or however you prefer. I find it easier to test various parameters this way rather than setting the command line arguments each time.

这篇关于Visual Studio 2013 - 如何在控制台中查看输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆