Serilog 缺少什么命名空间? [英] What namespace am I missing for Serilog?

查看:39
本文介绍了Serilog 缺少什么命名空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和 Serilog 缺少什么 namspace?

我可以在带有各种 Serilog 接收器的 C# 代码中使用 LoggerConfiguration(),但我的编译器抱怨我使用.WriteTo.File"的规范.我很困惑,因为我已经能够在另一个演示解决方案中使用这个规范.我想知道是否需要添加某种程序集作为参考.我已经从包管理器控制台"运行了Install-Package Serilog.Sinks.File",但这似乎没有任何影响或改变.<​​/p>

我缺少什么指令或我需要什么程序集引用?

我试图通过在线文档解决这个问题,但我找不到结果.

解决方案

你只需要成为

使用 Serilog;

您显示的消息表明 Add-Package 的处理存在一些问题,这在大纲中似乎是正确的 - 我将检查 NuGet 引用并查看它是否确实存在已申请;没有它就行不通.

What namspace and I missing for Serilog?

I am able to use LoggerConfiguration() in my C# code with various Serilog Sinks but my compiler is complaining about the specification of my use of ".WriteTo.File". I am confused because I have ben able to use this specification in another demo solution. I wonder if there is some sort of Assembly I need to add as a reference. I have run "Install-Package Serilog.Sinks.File" from the "Package Manager Console" but that did not seem to have any effect or change.

What directive am I missing or what assembly reference do I need?

I tried to figure this out via online documentation but I can not find the result.

解决方案

You only need to be

using Serilog;

The message you've shown suggests there's been some problem with the processing off the Add-Package, which seems correct in outline - I'd be checking the NuGet references and seeing whether it's actually been applied; it's not going to work without it.

这篇关于Serilog 缺少什么命名空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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