Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation 5.0.0 is not compatible with netcoreapp3.1

I'm trying to install Nuget package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation on a .Net core 3.1 project and getting following error. "Package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation 5.0.0 is not compatible with netcoreapp3.1"

I have already updated all the existing packages but no luck. Has anyone encountered this error?

like image 684
Sajithd Avatar asked Nov 16 '20 10:11

Sajithd


2 Answers

Because Package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation 5.0.0 depends on net5.0.

You should install a version compatible with .net core 3.1,like Package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation -Version 3.x

like image 85
Yinqiu Avatar answered Oct 18 '22 18:10

Yinqiu


For me this one worked in the integrated VS terminal.

dotnet add package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation --version 3.1.10

like image 27
Kerox Avatar answered Oct 18 '22 19:10

Kerox