Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft.AspNetCore.App 2.1.1 upgrade "Blocked by project"

I'm trying to upgrade a .net core 2.1 project to the latest version of Nuget packages such as Microsoft.Extensions.DependencyInjection.Abstractions 2.1.1.

However this is blocked by the package reference Microsoft.NETCore.App, when I try to upgrade the "meta" package Microsoft.NETCore.App I see "Blocked by project" similar to this question. That was resolved by switching to the newer version of the SDK, however that isn't an option here... because there isn't a newer version of the SDK (yet?).

I've also seen this answer to upgrade specific packages by editing the .csproj file manually with an Update package reference but I doubt that's the intended method of doing this.

How should I go about this? For now I've just manually included the package references I actually use and dropped the meta package but I can't imagine that's the intended way to go about this.

like image 687
Elva Avatar asked Jun 21 '18 13:06

Elva


2 Answers

Easy. Was looking for a resolution for this earlier and I all I had to do was just add this in the projects affected.

  <PropertyGroup>     <RuntimeFrameworkVersion>2.1.1</RuntimeFrameworkVersion>   </PropertyGroup> 

Additionally for .NET Core 3 and beyond,

   <PropertyGroup>      <TargetFramework>netcoreapp3.1</TargetFramework>    </PropertyGroup> 

There was also an answer posted by Patrick below pointing out that certain projects require the .NET Core App NuGet Package. You won't need that anymore after .NET Core 3.

like image 81
Nicholas Avatar answered Nov 13 '22 21:11

Nicholas


In my case it was caused by missing Version attribute on Microsoft.AspNetCore.App.

For some reason when the WebApi project was created the package was referenced like this:

<PackageReference Include="Microsoft.AspNetCore.App" /> 

Adding the missing attribute resolved all issues with updates and builds on the build server.

<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" /> 
like image 32
Patrick Avatar answered Nov 13 '22 22:11

Patrick