title: Fixing C# dotnetcore3.1 log4net 2.0.8: Detected package downgrade error
body: <p>I'm trying to get log4net working under a dotnetcore3.1 project. I am continuously getting spammed with errors like this:</p>
  
  <pre><code>error NU1605: Detected package downgrade: System.Diagnostics.Debug from 4.3.0 to 4.0.11. Reference the package directly from the project to select a different version.  [/app/MyProject.csproj]
  </code></pre>
  
  <p>csproj boils down to this:</p>
  
  <pre><code>&lt;Project Sdk="Microsoft.NET.Sdk"&gt;
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netcoreapp3.1&lt;/TargetFramework&gt;
      &lt;OutputType&gt;exe&lt;/OutputType&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;PackageReference Include="log4net" Version="2.0.8" /&gt;
    &lt;/ItemGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  
  <p>Environment:</p>
  
  <ul>
  <li>dotnetcore3.1</li>
  <li>docker build image: mcr.microsoft.com/dotnet/core/sdk:3.1</li>
  <li>docker runtime image: mcr.microsoft.com/dotnet/core/runtime:3.1-bionic</li>
  </ul>
  
  <p>Unacceptable "fixes":</p>
  
  <ul>
  <li>"Just add <code>&lt;WarningsAsErrors&gt;&lt;/WarningsAsErrors&gt;</code>"</li>
  <li>Anything that involves opening Visual Studio</li>
  </ul>
  
  <p>There are several posts for this problem, but they seem to either suppress the error and move on, or they use Visual Studio "magic" to solve it.</p>
  
  <p>Based on this message, <code>Reference the package directly from the project to select a different version.</code>, I've tried adding package references to my csproj, but none of "System", "System.Diagnostics", or "System.Diagnostics.Debug" work.</p>
  
  <p>How do you actually fix this problem?</p>
  
  <p>Please be specific. I'm still new to C# and many solutions I've found may not have worked because they simply said add <code>&lt;SomeXmlTag /&gt;</code> and I had no idea where to put it or under what parent to drop the tag.</p>
  
  <hr>
  
  <p>Per Gray Cat, I tried: <a href="https://stackoverflow.com/questions/46111749/adding-a-bindingredirect-to-a-net-standard-library">Adding a bindingRedirect to a .Net Standard library</a></p>
  
  <p>Originally it didn't seem like it changed the output at all. After playing with the verbosity, I found this:</p>
  
  <pre><code>   "/app/MyProject.csproj" (Publish target) (1) -&gt;
     (ResolveAssemblyReferences target) -&gt; 
  /usr/share/dotnet/sdk/3.1.100/Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3277: Found conflicts between different versions of "System.Configuration.ConfigurationManager" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [/app/MyProject.csproj]
       /usr/share/dotnet/sdk/3.1.100/Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3277: Found conflicts between different versions of "System.Security.AccessControl" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [/app/MyProject.csproj]
       /usr/share/dotnet/sdk/3.1.100/Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3277: Found conflicts between different versions of "System.Security.Permissions" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [/app/MyProject.csproj]
       /usr/share/dotnet/sdk/3.1.100/Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3277: Found conflicts between different versions of "System.Security.Principal.Windows" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [/app/MyProject.csproj]
  </code></pre>
  
  <p>Wonderfully, it's supposed to include the details, but I can't find them in the pages of output I'm looking at.</p>