I just upgraded an ASP.NET Core Web API project from .NET 6 to .NET 8. I would like to remove all the deprecated dependencies but I have some problems.
For example, when updating Microsoft.Data.SqlClient
from 3.1.0 to 5.2.0, I get the following error
Error NU1605
Warning As Error: Detected package downgrade: System.Threading.Tasks from 4.3.0 to 4.0.11. Reference the package directly from the project to select a different version.
BD.Shared.DWA -> Microsoft.AspNetCore.Mvc.Core 2.2.5 -> Microsoft.Extensions.DependencyModel 2.1.0 -> Microsoft.DotNet.PlatformAbstractions 2.1.0 -> System.IO.FileSystem 4.0.1 -> runtime .win.System.IO.FileSystem 4.3.0 -> System.Threading.Tasks (>= 4.3.0)
BD.Shared.DWA -> Microsoft.AspNetCore.Mvc.Core 2.2.5 -> Microsoft.Extensions.DependencyModel 2.1.0 -> Microsoft.DotNet.PlatformAbstractions 2.1.0 -> System.IO.FileSystem 4.0.1 -> System .Threading.Tasks (>= 4.0.11) BD.Shared.DWA D:\GIT\DWA\MAIN\BD.Shared.DWA\BD.Shared.DWA.csproj 1
In fact the dependency Microsoft.AspNetCore.Mvc.Core
, deprecated too, contains the dependency to System.Threading.Tasks
v4.0.11
this the project file
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Platforms>AnyCPU;x64</Platforms>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
<PlatformTarget>AnyCPU</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.36" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.2.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageReference Include="MongoDB.Driver" Version="2.15.0" />
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="7.0.0" />
<PackageReference Include="System.Threading.Tasks" Version="4.0.11" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\PublishProfiles\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DWA.Logging\DWA.Logging.csproj" />
<ProjectReference Include="..\DWA.Product.Configuration\DWA.Product.Configuration.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="BD.Shared.DWA.nlog">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Config\BD.Shared.DWA.Production.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Config\BD.Shared.DWA.Staging.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Config\BD.Shared.DWA.Development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Config\BD.Shared.DWA.Local.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
Is there a way to upgrade Microsoft.Data.SqlClient
to 5.0.2?
Microsoft.AspNetCore.Mvc.Core
is deprecated but isn't a newer version, what can I replace it with?
You have explicitly installed System.Threading.Tasks
- remove it.
Also remove all Microsoft.AspNetCore.*
packages, those are obsolete - see the Migrate from ASP.NET Core 2.2 to 3.0 guide:
A large number of NuGet packages aren't produced for ASP.NET Core 3.0. Such package references should be removed from your project file.
Hence those packages are not distributed anymore and come with the framework/runtime itself.
See also: