I’m attempting to use the Jdenticon.AspNet.WebApi nuget package in my project. My project uses Target Framework .NET 6.0
. From what I can tell, the Jdenticon.AspNet.WebApi
package doesn’t support .NET 6.0
? However, the Jdenticon website says that ASP.NET WebApi 4.0+
is supported.
When I try to use the package in my Minimal API Project, I get the following error:
Assembly 'Jdenticon.AspNet.WebApi' with identity 'Jdenticon.AspNet.WebApi, Version=3.1.2.0, Culture=neutral, PublicKeyToken=3fcf9f6e3475a4f8' uses 'System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Http' with identity 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
My question is, is it possible to use a package like this that was built for an older version(?) of .NET?
2
Answers
Thanks to the other comments and answers, I found that the package I was trying to use,
Jdenticon.AspNet.WebApi
, was made for .NET, and not .NET Core, which was what my project was. My ultimate solution was to just not use this package.More specifically in regards to my problem, I found that all I needed was the base Jdenticon-net package.
The error message is telling you that you are already using
System.Web.Http
. But the version you are using is4.0
, while the library you are installing require version5.0
. Since these are different mayor versions there is no guarantee about backward compatibility, so nuget will not update the library automatically, since it could result in compilation errors.So go into nuget and update
System.Web.Http
to version5.0
. If you are lucky you will not have any errors, but you might need to fix some minor issues like namespaces or similar. If you are really unlucky there are major incompatible changes that forces you to reconsider the update, so make sure you commit any changes before starting, so you have a good point to return to if there are issues.You could also see if there is any older version of the package that uses the
4.0
version. I would not trust the website, since it could easily be outdated.But the best solution is probably to use a library specifically for .net core+, i.e.
Jdenticon.AspNetCore
.This does not really have anything to do with .Net 6 vs .net framework. But there might be other issues, there is no guarantee that a .net framework package will work in .net 6.