NuGet 包 Serilog.Sinks.File 在发布时出错。
我正在尝试发布一个独立的 WPF .NET Core 3.0 应用程序。在添加 Serilog.Sinks.File 之前,应用程序构建、运行良好并发布良好。一旦将 Serilog.Sinks.File 添加到项目中,应用程序就会正确构建/运行甚至记录。但是,在尝试发布时给出此错误;
System.AggregateException: One or more errors occurred. ---> System.Exception: Publishing failed. --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<>c__DisplayClass26_0.b__2() at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Publish.Framework.Model.DefaultPublishSteps.d__23.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel.d__205.MoveNext() ---> (Inner Exception #0) System.Exception: Publishing failed.<---
System.Exception: Publishing failed.
===================
删除 Serilog.Sinks.File 并发布应用。
即使删除 Serilog 初始化命令,也会出现同样的错误。
最佳答案
我发现解决方案证明 Serilog.Sinks.File
不是正确的 Nuget 包。您需要使用 Serilog.AspNetCore
然后应用程序才能发布。
关于c# - 发布 WPF .Net Core 3 应用程序和 Serilog.Sinks.File,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57775965/