visual-studio.net-corenugetmultiple-versions

.net core 2.2.0 vs 2.2.7 cannot consolidate, because versions locked by project


I have a Visual Studio solution relying on .net core 2.2. Once updated to sdk 2.2.7, only one project depends on SDK->Microsoft.NETCore.App 2.2.7; the other projects keeps referring to SDK->Microsoft.NETCore.App 2.2.0.

Going in nuget manager, Consolidate tab, it is not possible to align the versions between projects because "locked by project" (see below).

Any idea? Thanks a lot

Lorenzo

enter image description here


Solution

  • Going in nuget manager, Consolidate tab, it is not possible to align the versions between projects because "locked by project" (see below).

    See Consolidate tab, this option can't work when one project in your solution don't support being updated.

    For those .net core and asp.net core projects,by default they use the version 2.2.0, and it's not supported to consolidate them by manage packages for solution or update it by manage packages for project, we have to update those projects one-by-one following the steps:

    1.Right-click the project=>Edit xxx.csproj

    2.If there exists statement like <PackageReference Include="Microsoft.NETCore.App" />, explicitly add the version 2.2.0 to it: <PackageReference Include="Microsoft.NETCore.App" Version="2.2.0" />. If there not exists such statement, add it manually.

    3.Then now right-click the project=>Manage nuget packages, you can choose the 2.2.7 version to update.

    Note: It requires us to install the corresponding sdk and runtime in machine. And according to Martin's answer, in most cases you never need to update the blocked projects,please check if you have specific reason to update or consolidate it.