Detected package downgrade: Microsoft.NETCore.App from 2.1.3 to 2.1.0

I just experienced this same issue after adding a reference to MySQL.Data.

The only solution was to explicitly define the version of the affected references in the .csproj file:

<PackageReference Include="System.Diagnostics.Debug" Version="4.3.0" />
<PackageReference Include="System.Runtime.Extensions" Version="4.3.0" />
<PackageReference Include="System.Globalization" Version="4.3.0" />
<PackageReference Include="System.Threading" Version="4.3.0" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />

I had a similar issue to you. Could not publish my project when I specified a runtime identifier.

The solution I got to work was to add in the following line to the *.csproj

    <TargetFramework> xxx </TargetFramework>     
    <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>  <<<----- Add this line  

After that line was added the project would publish correctly.

The below link references a downgrade issue between 2.1.1 and 2.1.0 but the solution worked the same.

I had a missing version in the csproj file.

Adding the version fixed the issue.

enter image description here