-1

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

LorenzoGi
  • 256
  • 4
  • 14
  • It makes no sense to mix 2.2.0 and 2.2.7. You should always target what is the latest of 2.2 release so that remain supported by Microsoft. – Lex Li Oct 14 '19 at 04:43
  • Hi, any update for this issue? – LoLance Oct 17 '19 at 07:28
  • Hi Lance. I was out of office, sorry for the late reply. Yes, it works. Thanks a lot – LorenzoGi Oct 17 '19 at 07:57
  • Lex Li, yes it is nonesense to mix, but it was not my choice. It depended on installing more recent SDK, that VS managed "on its own", updating only 1 project in the whole solution... – LorenzoGi Oct 17 '19 at 07:59
  • "Consolidate" tab And Sync-Package were discussing in https://stackoverflow.com/questions/26792624/how-to-enforce-same-nuget-package-version-across-multiple-c-sharp-projects/71934573#71934573 question – Michael Freidgeim May 29 '22 at 21:56
  • Does this answer your question? [Visual Studio 2017 cannot update Microsoft.NETCore.App package ("Blocked by project")](https://stackoverflow.com/questions/44026190/visual-studio-2017-cannot-update-microsoft-netcore-app-package-blocked-by-proj) – Michael Freidgeim May 29 '22 at 21:57

1 Answers1

0

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.

LoLance
  • 25,666
  • 1
  • 39
  • 73