.net-core - 如果我引用 Log4Net nuget 包,.net core 3.1 将不会发布到 linux
问题描述
我有一个简单的工作应用程序(使用工作人员服务模板),它只是一个帮助我移动 .net 核心项目以在 linux 上运行的测试。我的问题是,当我引用 log4Net 的 nuget 包时,我在尝试发布时遇到错误。
目标位置:本地 HD 上的文件配置:发布目标框架:netcoreapp3.1 目标运行时:linux-x64
"Publish has encountered an error.
Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. "
检查临时目录中的日志显示
"3/9/2020 11:09:39 AM
System.AggregateException: One or more errors occurred. ---> System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
--- 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.<IsBuildCompletedSuccessfully>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.<DefaultCorePublishStep>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.<RunPublishTaskAsync>d__213.MoveNext()
---> (Inner Exception #0) System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. <---
System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details.
===================
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UserSecretsId>dotnet-UnbuntuWorker-7195FC82-40A3-4F0A-A32C-29EA1B03EA6E</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.8" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.1" />
</ItemGroup>
<ItemGroup>
<Content Update="log4net.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Folder Include="LogConfig\" />
</ItemGroup>
</Project>
谢谢你的帮助
解决方案
以防其他人遇到此问题。我通过添加一堆 Nuget 包解决了这个问题。我通过针对 linux 的 VS 开发人员命令提示符运行构建来找出哪些包
dotnet build -r linux-x64
这给了我一堆关于 System.xxx.xxx 是错误版本的错误,所以我不得不在 nuget 上找到它们以获得最新版本。
奇怪的是,有时我会添加一个版本,但仍然会收到错误,然后旧版本会出现在依赖项中。通常删除它并重新添加它会解决它。
一旦所有问题都解决了,它就会最终发布。
推荐阅读
- encryption - 当 yml 嵌入加密变量时 include_vars 期间出错
- javascript - 如何以块的形式发送包含多个文件的 FormData
- wolfram-mathematica - 除非我先设置微分函数,否则 Mathematica dsolve 会失败
- php - 在 css 中使用 php,substr_count() 搜索文件位置
- laravel - 满足条件时,Laravel 允许用户访问特定路线
- android - 可点击视图是异步的?
- java - Spring JPA - 在代码中实现唯一约束 - Tx 隔离级别
- java - 如何在代码覆盖中覆盖equals方法
- javascript - 如何让 Quokka.js 识别本地模块
- amazon-web-services - 如何在 AWS 任务定义中指定磁盘空间?