Anyone managed to install Microsoft.Identity.Web and run on ASP.NET Core 2.1?
I've got quite a few ASP.NET Core 2.1 API projects as they have to refer to DLLs targeting .NET 4.7.2. The apps use Azure AD as authentication and I recently tried hours to upgrade to Microsoft.Identity.Web
without success. It depends on Microsoft.Extensions.* 5.0
or later. It causes Kestrel to throw an error right after startup:
System.TypeLoadException: Could not load type 'Microsoft.Extensions.Primitives.InplaceStringBuilder' from assembly 'Microsoft.Extensions.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
at Microsoft.Net.Http.Headers.DateTimeFormatter.ToRfc1123String(DateTimeOffset dateTime, Boolean quoted)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.DateHeaderValueManager.SetDateValues(DateTimeOffset value)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.CreateServiceContext(IOptions1 options, ILoggerFactory loggerFactory) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer..ctor(IOptions
1 options, ITransportFactory transportFactory, ILoggerFactory loggerFactory)
It seems that a method removed when Extentions.Primitive
became 5.0 that is required to run Kestrel. Any workaround?
Additional note (13/Oct/21):
As Microsoft.Extensions.Primitives has not been installed explicitly, it is not shown on the Nuget package list, therefor impossible to downgrade. If I try install older version such as 2.1.6 explicitly, it refuses with the error:
NU1605: Detected package downgrade: Microsoft.Extensions.Primitives from 5.0.0 to 2.1.6. Reference the package directly from the project to select a different version. test21 -> Microsoft.Identity.Web 1.18.0 -> Microsoft.Extensions.Caching.Memory 5.0.0 -> Microsoft.Extensions.Primitives (>= 5.0.0) test21 -> Microsoft.Extensions.Primitives (>= 2.1.6)