How to solve nuget DLL hell after upgrading to ASP.NET MVC 5 and Web API 2

I upgraded ASP.NET MVC4 to ASP.NET MVC 5.1 after these steps from this website

I am stuck in updating nuget packages, there are a lot of bugs and rollbacks:

eg

Install failed. Rolling back... Install-Package : Updating 'Microsoft.AspNet.WebApi.Core 4.0.20710.0' to 'Microsoft.AspNet.WebApi.Core 5.1.0' failed. Unable to find a version of 'Microsoft.AspNet.WebApi.OData' that is compatible with 'Microsoft.AspNet. WebApi.Core 5.1.0'. 

or

 Update-Package : Updating 'Microsoft.Net.Http 2.0.20710.0' to 'Microsoft.Net.Http 2.2.18' failed. Unable to find versions of 'Microsoft.AspNet.WebApi.Client, Microsoft.AspNet.WebApi.OData' that are compatible with 'Microsoft.Net.Http 2.2.18'. 

Is there an easy way to clean and update everything and get rid of this DLL addon?

+8
asp.net-mvc asp.net-mvc-4 asp.net-mvc-5
source share
2 answers

A quick way to remove all nuget packages in your project is to manually edit the packages.config file and then delete all the dll links (only for DLL packages in nuget packages).

This takes a lot less time than removing and then everything through the nuget package manager, especially when there is such a large dependency tree.

+8
source share

Finally, I solved it, even if the update with the nuget "Update-Package" command failed.

  • I delete through nuget all the problematic packages and their dependencies for each project.
  • I installed the same .NET Framework 4.5.1 for all projects in the solution (maybe not necessary).
  • I install these packages through nuget one by one.
  • I checked the result by comparing the links between the project using the FindConflictingReferences tool https://gist.github.com/brianlow/1553265 and resolved possible conflicts.

He asked me to correct for a long time ...

+2
source share

All Articles