asp.net Solution to version compatibility of metapackage DLL referenced by core3.1

Time:2020-9-4

Since. NETCORE 3.1 came out, everyone wants to upgrade to the latest version. So do I. Microsoft is constantly upgrading the official components of. NETCORE 3.1. Almost every few days, some metapackages can be upgraded. Every time you open nuget package manager, there will always be a number in the “update” tab to indicate that you can upgrade quickly! Students who have always been addicted to code cleanliness (including me) will click “upgrade all” without hesitation. We always fantasize about using higher versions to get better features and faster performance.

Unfortunately, the dream is good, but the ending is cruel. After upgrading, we found many errors. . NETCORE 3.1 has a great improvement in performance. It is much better than. NETCORE 2.2 in all aspects. However, its ecology has not been fully developed. Many third-party components are still NETCORE 2.2 or even lower. At this time, the most troublesome problem is the version of the package, such as the following errors:

MuXue.Zyiz.Net.WebAPI/MuXue.Zyiz.Net.WebAPI.csproj : error NU1605: Detected package downgrade: System.Threading.ThreadPool from 4.3.0 to 4.0.10. Reference the package directly from the project to select a different version.

Error nu1605: detected package degradation means “error nu1605: package degradation detected”. As we all know, there are many sub components in the meta package. If the sub component versions referenced by multiple metapackages are inconsistent, this error will be caused. This often happens in the current situation of. NETCORE 3.1.

According to the official tutorial, the solution is as follows:

Force the package with inconsistent versions to upgrade to the unified Version (such as our one here System.Threading.ThreadPool )

double-click MuXue.Zyiz.Net . WebAPI.csproj Project,


<ItemGroup>
 <PackageReference Include="AutoMapper" Version="9.0.0" />
 <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
 <PackageReference Include="Consul" Version="0.7.2.6" />
 <PackageReference Include="FluentValidation.AspNetCore" Version="8.6.1" />
 <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.1" />
 <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.1" />
 <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.1" />
 <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" />
 <PackageReference Include="NLog.Web.AspNetCore" Version="4.9.0" />
 <PackageReference Include="SkyAPM.Agent.AspNetCore" Version="0.9.0" />
 <PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0" />
 <PackageReference Include="System.Text.Json" Version="4.7.0" />
 <PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
 <PackageReference Include="System.Threading.ThreadPool" Version="4.3.0" />
 </ItemGroup>

See this line of code:


<PackageReference Include="System.Threading.ThreadPool" Version="4.3.0" />

The problem is solved by specifying the component as version 4.3.0.

This is about asp.net Core 3.1 reference metapackage DLL version compatibility problem solution article introduced here, more related asp.net For core DLL compatibility content, please search the previous articles of developeppaer or continue to browse the related articles below. I hope you can support developeppaer more in the future!