0
votes

I have a simple worker app (using the Worker Service Template) that is just a test to help me move a .net core project to run on linux. My issue is that when I reference the nuget package for log4Net I get an error when I try to publish.

Target Location: A file on local HD Configuration: Release Target Framework: netcoreapp3.1 Target Runtime: 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. "

Checking the log in the temp directory shows

"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>

Thanks for any help

1
Can you show the relevant sections in your csproj file? (Version of log4net, etc.)Matthew
Sure..Added it to original question. ThanksCharles Bender
Update this apparently happens when I target any runtime except "portable"Charles Bender

1 Answers

1
votes

In case anyone else runs into this issue. I solved it by adding a bunch of Nuget packages. I figured out which packages by running a build via VS Developer Command Prompt targeting linux

dotnet build -r linux-x64 

This gave me a bunch of errors about System.xxx.xxx being the wrong version so I had to then find them on nuget to get the latest version.

Oddly, sometimes I would add a version and still get the error and then the old version would show up in dependencies. Usually removing it and re-adding it would resolve it.

Once all the issues were resolve, it would finally publish.