.net core .net核心3.1韩元';如果我引用log4netnuget包,我不会发布到linux

.net core .net核心3.1韩元';如果我引用log4netnuget包,我不会发布到linux,.net-core,log4net,.net Core,Log4net,我有一个简单的worker应用程序(使用worker服务模板),它只是一个测试,帮助我将.net核心项目迁移到linux上运行。 我的问题是,当我引用log4Net的nuget包时,我在尝试发布时遇到了一个错误 目标位置:本地硬盘上的文件 配置:发布 目标框架:netcoreapp3.1 目标运行时:linux-x64 "Publish has encountered an error. Publish has encountered an error. We were unable to de

我有一个简单的worker应用程序(使用worker服务模板),它只是一个测试,帮助我将.net核心项目迁移到linux上运行。 我的问题是,当我引用log4Net的nuget包时,我在尝试发布时遇到了一个错误

目标位置:本地硬盘上的文件 配置:发布 目标框架: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>
“2020年3月9日上午11:09:39
System.AggregateException:发生一个或多个错误。-->System.Exception:发布遇到错误。我们无法确定错误原因。有关详细信息,请查看输出日志。
---内部异常堆栈跟踪的结束---
位于System.Threading.Tasks.Task.ThrowifeException(布尔值IncludeTaskCanceledException)
在System.Threading.Tasks.Task.Wait(Int32毫秒计时,CancellationToken CancellationToken)
在Microsoft.Publish.Framework.Model.DefaultPublishSteps.c__DisplayClass26_0.b__2()中
在System.Threading.Tasks.Task`1.InnerInvoke()中
在System.Threading.Tasks.Task.Execute()中
---来自引发异常的上一个位置的堆栈结束跟踪---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
在Microsoft.Publish.Framework.Model.DefaultPublishSteps.d_u23.MoveNext()中
---来自引发异常的上一个位置的堆栈结束跟踪---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
在Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel.d_u213.MoveNext()中

--->(内部异常#0)系统。异常:发布遇到错误。我们无法确定错误的原因。有关详细信息,请查看输出日志。以防其他人遇到此问题。我通过添加一组Nuget软件包解决了此问题。 我通过VS Developer命令提示符运行一个针对linux的构建,找出了哪些包

dotnet build -r linux-x64 
这给了我一大堆关于System.xxx.xxx是错误版本的错误,所以我必须在nuget上找到它们才能获得最新版本

奇怪的是,有时我会添加一个版本,但仍然会出现错误,然后旧版本会显示在依赖项中。通常删除它并重新添加它可以解决问题


一旦所有问题得到解决,它将最终发布。

您能在
csproj
文件中显示相关部分吗?(log4net版本等)当然……将其添加到原始问题中。ThanksUpdate当我针对除“portable”之外的任何运行时,显然会发生这种情况