C# ';调试';不包含';打印';

C# ';调试';不包含';打印';,c#,console,C#,Console,在下面的代码中,我只想在选中这两个复选框时将“hi”作为测试输出到控制台窗口中 using System; using System.Diagnostics; private void button_Click(object sender, RoutedEventArgs e) { show.Text = inputText.Text; if (check1_cont && check2_cont == true ) {

在下面的代码中,我只想在选中这两个复选框时将“hi”作为测试输出到控制台窗口中

using System;
using System.Diagnostics;

private void button_Click(object sender, RoutedEventArgs e)
    {
        show.Text = inputText.Text;
        if (check1_cont && check2_cont == true )
        {
            Debug.Print("hi");
        }
    }
唯一的问题是在System.Diagnostics中,“Debug.Print”中的“Print”似乎不存在。我检查过了,打印方法确实存在。如果您有任何关于缺少油漆方法的解决方案的帮助,我们将不胜感激

编辑1:

显然Debug.WriteLine没有给出错误,但是当我运行程序并选中这两个框并按下按钮时,没有控制台出现

编辑2:

如果它对任何人都有帮助,下面是我正在使用的GUI应用程序的完整代码

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Diagnostics;
using Microsoft;
using System.Threading.Tasks;
using System.Data;
using System.Dynamic;
using System.Xml;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409

namespace normieap
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {
        public Boolean check1_cont = false;
        public Boolean check2_cont = false;

        public MainPage()
        {
            this.InitializeComponent();
        }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            show.Text = inputText.Text;
            if (check1_cont && check2_cont == true )
            {
                MessageBox.Show("hi");
            }

        }
        private void check1_Click(object sender, RoutedEventArgs e)
        {

            check1_cont = true;
        }
        private void check2_Click(object sender, RoutedEventArgs e)
        {
            check2_cont = true;
        }

    }
}
使用系统;
使用System.Collections.Generic;
使用System.IO;
使用System.Linq;
使用系统文本;
Net系统;
使用System.Net.Sockets;
使用系统诊断;
使用微软;
使用System.Threading.Tasks;
使用系统数据;
运用系统动力学;
使用System.Xml;
使用System.Runtime.InteropServices.WindowsRuntime;
使用Windows基金会;
使用Windows。
使用Windows.UI.Xaml;
使用Windows.UI.Xaml.Controls;
使用Windows.UI.Xaml.Controls.Primitives;
使用Windows.UI.Xaml.Data;
使用Windows.UI.Xaml.Input;
使用Windows.UI.Xaml.Media;
使用Windows.UI.Xaml.Navigation;
//空白页项模板被记录在http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
名称空间规范
{
/// 
///可以单独使用或在框架内导航到的空页。
/// 
公共密封部分类主页面:第页
{
公共布尔校验1_cont=false;
公共布尔校验2_cont=false;
公共主页()
{
this.InitializeComponent();
}
私有无效按钮\u单击(对象发送者,路由目标e)
{
show.Text=inputText.Text;
if(check1_cont&&check2_cont==true)
{
MessageBox.Show(“hi”);
}
}
私有无效检查1_单击(对象发送方,路由目标)
{
检查1_cont=true;
}
私有无效检查2_单击(对象发送者,路由目标e)
{
检查2_cont=true;
}
}
}
该按钮将导致同时执行多个操作,我希望同时执行的操作之一是打开某种控制台窗口的实例

编辑3:


这本来是一个用于PC的应用程序,但由于某种原因,当我启动该项目时,Visual Studio 2015社区认为它是一个用于手机的应用程序,并导致PC专用命令出现问题。如果有人能提供关于如何解决这个问题的信息,那就太好了

您似乎没有使用完整的桌面框架,而是使用某种移动框架。例如,如果选中,您可以看到
Debug.Print
不可用

如果您检查“版本信息”以进行打印,您将看到

版本信息
.NET框架
从2.0开始提供

改用Debug.WriteLine(“hi”),它的版本信息显示,这应该可以在所有框架中工作

版本信息
通用Windows平台
从4.5开始提供
.NET框架
从1.1开始提供
可移植类库
支持:可移植.NET平台
Silverlight
从2.0开始提供
Windows Phone Silverlight
从7.0开始提供
Windows Phone
从8.1开始提供

如果您没有看到输出,我建议您显示测试变量

private void button_Click(object sender, RoutedEventArgs e)
{
    show.Text = inputText.Text;
    Debug.WriteLine(check1_cont.ToString());
    Debug.WriteLine(check2_cont.ToString());
}

我猜您正在寻找
Debug.WriteLine(…)
Console.WriteLine(…)
您的项目中是否有名为
Debug
的类。如果您执行
System.Diagnostics.Debug.Print(“hi”),这样行吗?或者您是在为windows phone或类似平台构建,而不是使用完整的.NET framework?对于“编辑3”,老实说,您最好创建一个新项目,然后复制您的文件。