本文介绍了.NET Core和nix * es上的Mono中的'System.Diagnostics'中不存在'Eventing'名称空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在开发一个C#应用程序,该应用程序可以使用以下导入来读取和查询Windows事件日志:

I'm currently developing a C# application that can read and query Windows Event Logs using the following import:

using System.Diagnostics.Eventing.Reader;

此导入在使用Visual Studio 2017的Windows 10笔记本电脑上正常运行.但是,在dotnet run上运行此导入并在mcs上编译此导入时,出现以下错误:

This import worked fine on my Windows 10 laptop using Visual Studio 2017. However, I got the following error running this import on dotnet run and compiling this on mcs:

Program.cs(3,26): error CS0234: The type or namespace name `Eventing' does not 
exist in the namespace `System.Diagnostics'. Are you missing an assembly 
reference? Compilation failed: 1 error(s), 0 warnings

我已经尝试在Mac OS X笔记本电脑和单Docker容器上进行编译 .由于我在他们的 GitHub存储库.有人知道吗?我一直在尝试找到dll或导入文件来完成这项工作,但到目前为止没有成功.任何帮助将不胜感激.

I've tried the compilation on Mac OS X laptop and the mono Docker container. It seems like it should work on Mac and Linux since I found the code on their GitHub repository. Anyone have a clue? I have been trying to find a dll or an import to make this work, but no success so far. Any help would be appreciated.

推荐答案

.NET Framework的该部分尚未移植到.NET Core 2.0中.目前正在实施中.请参阅:将System.Diagnostics.EventLog移植到.NET Core ,这是正在进行的工作之一将更多的System.Diagnostics命名空间引入.NET Core. EventLog将在v2.1.0中发布.

That part of .NET Framework has not been ported into .NET Core 2.0. It is currently in implementation. See: Port System.Diagnostics.EventLog to .NET Core which is a part ongoing effort to bring more of System.Diagnostics namespace into .NET Core. EventLog will be shipped in v2.1.0.

我不知道System.Diagnostics.Eventing.Reader的发行版本.

System.Diagnostics.EventLog被重定向到syslog.还应该支持日志读取

System.Diagnostics.EventLog is redirected to syslog on Linux. Reading of logs should be supported as well

这篇关于.NET Core和nix * es上的Mono中的'System.Diagnostics'中不存在'Eventing'名称空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 17:18