I have an existing project that was built with .NET Framework which has an output of class library which has Identity Server 3 installed on it. I want to know if its possible to install IDS 4 on the project or if I should just change the project to target .NET Core instead?
When I try installing it, I get the following error:
Error: Could not install package ‘IdentityServer4 4.0.0’. You are trying to install this package into a project that targets ‘.NETFramework,Version=v4.8’, 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.
I’ve tried installing different versions of the package as with no luck.
2
Answers
No you cannot install IDS 4 on a .NET Framework project. IDS 4 is built to work with .NET Core; trying to use it with a totally different framework is not something you should expect to work (.NET Core is not simply "a newer version of .NET than .NET Framework 4.8"… it’s a total rewrite of the .NET platform).
As to whether you should just change the project to target .NET Core, that’s a subjective matter (e.g. do you need IDS4, or can you just keep using IDS 3? The answer would depend on your preferences or the customer’s requirements).
The current (version 4.x) and previous (version 3.x) major versions of IdentityServer4 both depend upon .NETCoreApp 3.1.
But… version 2.x only had a dependency on .NET Standard 2.0 so you could, at a push, use that in a .NET Framework application.
However, you should seriously contemplate upgrading to ASP.NET Core as you’ll end up hitting similar restrictions when attempting to upgrade various packages.