Windows Runtime:它是否包含日志记录库?

8

@DavidHeffernan:我添加了正确的 using 语句并尝试访问 EventLogConsole 类,但是 Visual Studio 11 指出它们分别不是 System.DiagnosticsSystem 命名空间的类。我还认为可能缺少引用,但是“添加引用”对话框中没有可添加的内容。每次调试应用程序时,我会看到加载了 mscorlib。 - Daniel Trebbien
@DavidHeffernan:我刚试着通过浏览添加一个System的引用,但是VS报告说“项目中已经存在对组件'System'的引用。” - Daniel Trebbien
根据文档,在.net 4.5中存在这些类:http://msdn.microsoft.com/en-us/library/system.console(v=VS.110).aspx http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog(v=VS.110).aspx 您的开发预览版安装可能出现了问题。您正在做什么样的项目? - David Heffernan
1
地铁有控制台窗口的话会很惊讶。 - David Heffernan
7
Metro应用程序是沙箱环境,无法访问完整的.NET框架。其中很多排除项都很烦人。 - Robert Levy
显示剩余3条评论
6个回答

6

5

我找到的唯一信息是(System.Diagnostics.Debug.WriteLine()):

    //
    // Summary:
    //     Writes a message followed by a line terminator to the trace listeners in
    //     the System.Diagnostics.Debug.Listeners collection.
    //
    // Parameters:
    //   message:
    //     A message to write.
    [Conditional("DEBUG")]
    public static void WriteLine(string message);

它将写入到Visual Studio输出窗口的调试输出。


所以基本上,它就是老好用的 System.Diagnostics.Debug.WriteLine() - BoltClock

2


1

您可以在.NET Windows Store应用程序中使用System.Diagnostics.Tracing类(http://msdn.microsoft.com/en-us/library/system.diagnostics.tracing.aspx)。但是,您不能使用它们写入Windows事件日志。


0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接