lib.web.mvc installation issue with VS 2017

291 Views Asked by At

I am getting the following error while installing the lib.web.mvc.6.8.2 package with VS 2017. It seems there is an issue with the dependency Microsoft.AspNet.Mvc already installed:

PM> Install-Package Microsoft.AspNet.Mvc

Package 'Microsoft.AspNet.Mvc.5.2.3' already exists in project 'MyMVCApplication' Time Elapsed: 00:00:00.6708551

PM> Install-Package Lib.Web.Mvc -Version 6.8.2

Attempting to gather dependency information for package 'Lib.Web.Mvc.6.8.2' with respect to project 'MyMVCApplication', targeting '.NETFramework,Version=v4.5.2'

Gathering dependency information took 8,86 sec

Attempting to resolve dependencies for package 'Lib.Web.Mvc.6.8.2' with DependencyBehavior 'Lowest'

Resolving dependency information took 0 ms

Resolving actions to install package 'Lib.Web.Mvc.6.8.2'

Resolved actions to install package 'Lib.Web.Mvc.6.8.2'

Retrieving package 'Lib.Web.Mvc 6.8.2' from 'nuget.org'. Install failed. Rolling back...

Package 'Lib.Web.Mvc.6.8.2 : Microsoft.AspNet.Mvc [4.0.0, 6.0.0)' does not exist in project 'MyMVCApplication'

Package 'Lib.Web.Mvc.6.8.2 : Microsoft.AspNet.Mvc [4.0.0, 6.0.0)' does not exist in folder 'C:\Users\Cyberphil83\documents\visual studio 2017\Projects\MyMVCApplication\packages'

Executing nuget actions took 19,84 ms Install-Package : Could not install package 'Lib.Web.Mvc 6.8.2'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.2', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.At line:1 char:1 + Install-Package Lib.Web.Mvc -Version 6.8.2 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

2

There are 2 best solutions below

1
On

I checked the github of this project, and it looks like it is targeting .NET 4.6:

<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>

Lib.Web.Mvc.csproj

But your app is targeting 4.5.2.

So you have few options. One of them is to clone/fork this project and compile targeting 4.5.2. Or simply change your app to 4.6 (if possible?).

1
On

Since v6.8.0 release Lib.Web.Mvc requires .NET 4.6+ as it requires HTTP/2 support.

There is a v6.7.x branch which is fix-only branch supporting .NET 4.0+.

If you want to stick to .NET 4.5.2 you will have to use latest 6.7.x version:

PM> Install-Package Lib.Web.Mvc -Version 6.7.1

Alternative is to upgrade your project to .NET 4.6+.